Replace google guava with lighter library for a specific map implementation.
This commit is contained in:
parent
3e6cf96040
commit
4be37945cb
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,5 @@
|
|||||||
/.idea
|
/.idea
|
||||||
/*/target
|
/*/target
|
||||||
dependency-reduced-pom.xml
|
dependency-reduced-pom.xml
|
||||||
|
|
||||||
|
*.iml
|
@ -25,9 +25,9 @@
|
|||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.guava</groupId>
|
<groupId>org.plumelib</groupId>
|
||||||
<artifactId>guava</artifactId>
|
<artifactId>hashmap-util</artifactId>
|
||||||
<version>32.1.2-jre</version> <!-- Match the version imported by Paper API/BungeeCord API if possible -->
|
<version>0.0.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
@ -47,6 +47,7 @@
|
|||||||
<artifactSet>
|
<artifactSet>
|
||||||
<includes>
|
<includes>
|
||||||
<include>io.github.classgraph:classgraph</include>
|
<include>io.github.classgraph:classgraph</include>
|
||||||
|
<include>org.plumelib:*</include>
|
||||||
</includes>
|
</includes>
|
||||||
</artifactSet>
|
</artifactSet>
|
||||||
<filters>
|
<filters>
|
||||||
@ -60,6 +61,26 @@
|
|||||||
<exclude>META-INF/MANIFEST.MF</exclude>
|
<exclude>META-INF/MANIFEST.MF</exclude>
|
||||||
</excludes>
|
</excludes>
|
||||||
</filter>
|
</filter>
|
||||||
|
<filter>
|
||||||
|
<artifact>org.plumelib:hashmap-util</artifact>
|
||||||
|
<excludes>
|
||||||
|
<exclude>module-info.class</exclude>
|
||||||
|
<exclude>META-INF/*.SF</exclude>
|
||||||
|
<exclude>META-INF/*.DSA</exclude>
|
||||||
|
<exclude>META-INF/*.RSA</exclude>
|
||||||
|
<exclude>META-INF/MANIFEST.MF</exclude>
|
||||||
|
</excludes>
|
||||||
|
</filter>
|
||||||
|
<filter>
|
||||||
|
<artifact>org.plumelib:reflection-util</artifact>
|
||||||
|
<excludes>
|
||||||
|
<exclude>module-info.class</exclude>
|
||||||
|
<exclude>META-INF/*.SF</exclude>
|
||||||
|
<exclude>META-INF/*.DSA</exclude>
|
||||||
|
<exclude>META-INF/*.RSA</exclude>
|
||||||
|
<exclude>META-INF/MANIFEST.MF</exclude>
|
||||||
|
</excludes>
|
||||||
|
</filter>
|
||||||
</filters>
|
</filters>
|
||||||
<relocations>
|
<relocations>
|
||||||
<relocation>
|
<relocation>
|
||||||
@ -70,6 +91,10 @@
|
|||||||
<pattern>nonapi.io.github.classgraph</pattern>
|
<pattern>nonapi.io.github.classgraph</pattern>
|
||||||
<shadedPattern>fr.pandacube.lib.reflect.shaded.classgraph.nonapi</shadedPattern>
|
<shadedPattern>fr.pandacube.lib.reflect.shaded.classgraph.nonapi</shadedPattern>
|
||||||
</relocation>
|
</relocation>
|
||||||
|
<relocation>
|
||||||
|
<pattern>org.plumelib</pattern>
|
||||||
|
<shadedPattern>fr.pandacube.lib.reflect.shaded.plumelib</shadedPattern>
|
||||||
|
</relocation>
|
||||||
</relocations>
|
</relocations>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
package fr.pandacube.lib.reflect.wrapper;
|
package fr.pandacube.lib.reflect.wrapper;
|
||||||
|
|
||||||
import com.google.common.collect.MapMaker;
|
|
||||||
|
|
||||||
import fr.pandacube.lib.reflect.ReflectConstructor;
|
import fr.pandacube.lib.reflect.ReflectConstructor;
|
||||||
|
import org.plumelib.util.WeakIdentityHashMap;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -17,7 +16,10 @@ import static fr.pandacube.lib.util.ThrowableUtil.wrapEx;
|
|||||||
public abstract class ReflectWrapper implements ReflectWrapperI {
|
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.
|
* Unwraps the object from the provided reflect wrapper.
|
||||||
|
Loading…
Reference in New Issue
Block a user