leventov / Koloboke

Java Collections till the last breadcrumb of memory and performance
https://koloboke.com/
1k stars 138 forks source link

Could not initialize class com.koloboke.collect.map.hash.HashIntObjMaps$DefaultFactoryHolder #70

Open persal opened 4 years ago

persal commented 4 years ago

Using AdoptOpenJDK 11.0.5 First of all, is ver 1.0.0 compatible with JDK 11?

We get a NoClassDefFoundError with below stacktrace:

Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.koloboke.collect.map.hash.HashIntObjMaps$DefaultFactoryHolder at com.koloboke.collect.map.hash.HashIntObjMaps.getDefaultFactory(HashIntObjMaps.java:55) ~[koloboke-api-jdk8-1.0.0.jar:?] at com.koloboke.collect.map.hash.HashIntObjMaps.newImmutableMap(HashIntObjMaps.java:1499) ~[koloboke-api-jdk8-1.0.0.jar:?]

Code that breaks: TreeMap<Integer, DeserializeAction> map = new TreeMap<>(); ..do stuff this.map = HashIntObjMaps.newImmutableMap(map); //this line throws exception

The above code is initiated in a class in its initialization public class Myclass { DoStuff stuff = new DoStuff(); // triggers the above call to HashIntObjMaps.newImmutableMap(map);

}

We have following jar files in the classpath: koloboke-api-jdk8-1.0.0.jar koloboke-impl-common-jdk8-1.0.0.jar koloboke-impl-jdk8-1.0.0.jar

We have not been able to reproduce it consequently, but seem to happen from time to time.

persal commented 4 years ago

Understand this project is not actively being developed any more, but for the record the above issue has been solved and has nothing to do with this library but with another library managing the classloading.