diff --git a/core/src/mindustry/mod/ModClassLoader.java b/core/src/mindustry/mod/ModClassLoader.java index bf42f6cc00..40d6fd07ef 100644 --- a/core/src/mindustry/mod/ModClassLoader.java +++ b/core/src/mindustry/mod/ModClassLoader.java @@ -4,7 +4,12 @@ import arc.struct.*; public class ModClassLoader extends ClassLoader{ private Seq children = new Seq<>(); - private volatile boolean inChild = false; + private ThreadLocal inChild = new ThreadLocal<>(){ + @Override + protected Boolean initialValue(){ + return Boolean.FALSE; + } + }; public void addChild(ClassLoader child){ children.add(child); @@ -13,15 +18,15 @@ public class ModClassLoader extends ClassLoader{ @Override protected Class findClass(String name) throws ClassNotFoundException{ //a child may try to delegate class loading to its parent, which is *this class loader* - do not let that happen - if(inChild){ - inChild = false; + if(inChild.get()){ + inChild.set(false); throw new ClassNotFoundException(name); } ClassNotFoundException last = null; int size = children.size; - inChild = true; + inChild.set(true); //if it doesn't exist in the main class loader, try all the children for(int i = 0; i < size; i++){ try{ @@ -30,7 +35,7 @@ public class ModClassLoader extends ClassLoader{ last = e; } } - inChild = false; + inChild.set(false); throw (last == null ? new ClassNotFoundException(name) : last); } diff --git a/gradle.properties b/gradle.properties index 5e1622bd4c..34b13c8f1d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,4 +9,4 @@ kapt.use.worker.api=true kapt.include.compile.classpath=false # I don't need to use the kotlin stdlib yet, so remove it to prevent extra bloat & method count issues kotlin.stdlib.default.dependency=false -archash=ea70a34cc621c2c75d0aef5511c7f5aa4ced0d46 +archash=3926b785320fea0cd9ca597f6bfa9071263a5464