mirror of
https://github.com/apache/maven-mvnd.git
synced 2025-09-10 04:59:54 +00:00
Fix PluginDescriptorCache
The second get-method wasn't actually overloaded, but had a different signature than the superclass. This resulted in the superclass cache being filled and never cleared, even when flush is called.
This commit is contained in:

committed by
Guillaume Nodet

parent
a15abc25df
commit
dcf8dacfd4
@@ -48,12 +48,6 @@ import org.mvndaemon.mvnd.cache.CacheRecord;
|
||||
@Priority(10)
|
||||
public class InvalidatingPluginDescriptorCache extends DefaultPluginDescriptorCache {
|
||||
|
||||
@FunctionalInterface
|
||||
public interface PluginDescriptorSupplier {
|
||||
PluginDescriptor load()
|
||||
throws PluginResolutionException, PluginDescriptorParsingException, InvalidPluginDescriptorException;
|
||||
}
|
||||
|
||||
protected static class Record implements CacheRecord {
|
||||
|
||||
private final PluginDescriptor descriptor;
|
||||
@@ -71,6 +65,9 @@ public class InvalidatingPluginDescriptorCache extends DefaultPluginDescriptorCa
|
||||
@Override
|
||||
public void invalidate() {
|
||||
ClassRealm realm = descriptor.getClassRealm();
|
||||
if (realm == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
realm.getWorld().disposeRealm(realm.getId());
|
||||
} catch (NoSuchRealmException e) {
|
||||
@@ -97,6 +94,7 @@ public class InvalidatingPluginDescriptorCache extends DefaultPluginDescriptorCa
|
||||
return r != null ? clone(r.descriptor) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PluginDescriptor get(Key key, PluginDescriptorSupplier supplier)
|
||||
throws PluginDescriptorParsingException, PluginResolutionException, InvalidPluginDescriptorException {
|
||||
try {
|
||||
|
@@ -29,10 +29,7 @@ import java.util.Optional;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.apache.maven.model.Plugin;
|
||||
import org.apache.maven.plugin.DefaultPluginDescriptorCache;
|
||||
import org.apache.maven.plugin.InvalidPluginDescriptorException;
|
||||
import org.apache.maven.plugin.PluginDescriptorParsingException;
|
||||
import org.apache.maven.plugin.PluginResolutionException;
|
||||
import org.apache.maven.plugin.*;
|
||||
import org.apache.maven.plugin.descriptor.PluginDescriptor;
|
||||
import org.codehaus.plexus.classworlds.realm.ClassRealm;
|
||||
import org.codehaus.plexus.classworlds.realm.NoSuchRealmException;
|
||||
@@ -47,13 +44,6 @@ import org.mvndaemon.mvnd.cache.CacheRecord;
|
||||
@Named
|
||||
@Priority(10)
|
||||
public class InvalidatingPluginDescriptorCache extends DefaultPluginDescriptorCache {
|
||||
|
||||
@FunctionalInterface
|
||||
public interface PluginDescriptorSupplier {
|
||||
PluginDescriptor load()
|
||||
throws PluginResolutionException, PluginDescriptorParsingException, InvalidPluginDescriptorException;
|
||||
}
|
||||
|
||||
protected static class Record implements CacheRecord {
|
||||
|
||||
private final PluginDescriptor descriptor;
|
||||
@@ -71,6 +61,9 @@ public class InvalidatingPluginDescriptorCache extends DefaultPluginDescriptorCa
|
||||
@Override
|
||||
public void invalidate() {
|
||||
ClassRealm realm = descriptor.getClassRealm();
|
||||
if (realm == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
realm.getWorld().disposeRealm(realm.getId());
|
||||
} catch (NoSuchRealmException e) {
|
||||
@@ -97,6 +90,7 @@ public class InvalidatingPluginDescriptorCache extends DefaultPluginDescriptorCa
|
||||
return r != null ? clone(r.descriptor) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PluginDescriptor get(Key key, PluginDescriptorSupplier supplier)
|
||||
throws PluginDescriptorParsingException, PluginResolutionException, InvalidPluginDescriptorException {
|
||||
try {
|
||||
|
Reference in New Issue
Block a user