diff --git a/.gitignore b/.gitignore index ef1ca3c..f643fd5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ /.idea /*/target -dependency-reduced-pom.xml \ No newline at end of file +dependency-reduced-pom.xml + +*.iml \ No newline at end of file diff --git a/pandalib-reflect/pom.xml b/pandalib-reflect/pom.xml index 38fd2ea..164c222 100644 --- a/pandalib-reflect/pom.xml +++ b/pandalib-reflect/pom.xml @@ -25,9 +25,9 @@ ${project.version} - com.google.guava - guava - 32.1.2-jre + org.plumelib + hashmap-util + 0.0.1 @@ -47,6 +47,7 @@ io.github.classgraph:classgraph + org.plumelib:* @@ -60,6 +61,26 @@ META-INF/MANIFEST.MF + + org.plumelib:hashmap-util + + module-info.class + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + META-INF/MANIFEST.MF + + + + org.plumelib:reflection-util + + module-info.class + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + META-INF/MANIFEST.MF + + @@ -70,6 +91,10 @@ nonapi.io.github.classgraph fr.pandacube.lib.reflect.shaded.classgraph.nonapi + + org.plumelib + fr.pandacube.lib.reflect.shaded.plumelib + diff --git a/pandalib-reflect/src/main/java/fr/pandacube/lib/reflect/wrapper/ReflectWrapper.java b/pandalib-reflect/src/main/java/fr/pandacube/lib/reflect/wrapper/ReflectWrapper.java index 2c94572..1cd4369 100644 --- a/pandalib-reflect/src/main/java/fr/pandacube/lib/reflect/wrapper/ReflectWrapper.java +++ b/pandalib-reflect/src/main/java/fr/pandacube/lib/reflect/wrapper/ReflectWrapper.java @@ -1,8 +1,7 @@ package fr.pandacube.lib.reflect.wrapper; -import com.google.common.collect.MapMaker; - import fr.pandacube.lib.reflect.ReflectConstructor; +import org.plumelib.util.WeakIdentityHashMap; import java.util.List; import java.util.Map; @@ -17,7 +16,10 @@ import static fr.pandacube.lib.util.ThrowableUtil.wrapEx; public abstract class ReflectWrapper implements ReflectWrapperI { - private static final Map objectWrapperCache = new MapMaker().weakKeys().makeMap(); + private static final Map objectWrapperCache = new WeakIdentityHashMap<>(); + /* + * WeakHashMap is not suitable because we want the keys to be compared by reference (==) and not by the .equals() method. + */ /** * Unwraps the object from the provided reflect wrapper.