Replace google guava with lighter library for a specific map implementation.

This commit is contained in:
2024-07-27 17:41:21 +02:00
parent 3e6cf96040
commit 4be37945cb
3 changed files with 36 additions and 7 deletions

View File

@@ -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<Object, ReflectWrapperI> objectWrapperCache = new MapMaker().weakKeys().makeMap();
private static final Map<Object, ReflectWrapperI> 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.