From 446c2d2dcb944ede941abb5c7a371e5f285855c7 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 12 Jun 2021 11:00:56 -0400 Subject: [PATCH 1/2] more mod loader fixes --- core/src/mindustry/mod/ModClassLoader.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/core/src/mindustry/mod/ModClassLoader.java b/core/src/mindustry/mod/ModClassLoader.java index 40d6fd07ef..3124c16fed 100644 --- a/core/src/mindustry/mod/ModClassLoader.java +++ b/core/src/mindustry/mod/ModClassLoader.java @@ -26,16 +26,19 @@ public class ModClassLoader extends ClassLoader{ ClassNotFoundException last = null; int size = children.size; - 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{ - return children.get(i).loadClass(name); + try{ + inChild.set(true); + return children.get(i).loadClass(name); + }finally{ + inChild.set(false); + } }catch(ClassNotFoundException e){ last = e; } } - inChild.set(false); throw (last == null ? new ClassNotFoundException(name) : last); } From 7ec713ab66d0bd40bede2941df954a022f41d230 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 12 Jun 2021 14:26:47 -0400 Subject: [PATCH 2/2] No URLClassLoader super delegation --- core/src/mindustry/core/Platform.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/mindustry/core/Platform.java b/core/src/mindustry/core/Platform.java index ff139fa14a..a595668aa8 100644 --- a/core/src/mindustry/core/Platform.java +++ b/core/src/mindustry/core/Platform.java @@ -33,7 +33,7 @@ public interface Platform{ loadedClass = findClass(name); }catch(ClassNotFoundException e){ //use parent if not found - loadedClass = super.loadClass(name, resolve); + return parent.loadClass(name); } }