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