fix getting the ParallelLoaders class
All checks were successful
/ Build BaseBand Loader (push) Successful in 1m11s

This commit is contained in:
Daniella / Tove 2024-06-19 20:35:02 +02:00
parent 31ff41f96e
commit 1da1c2d96b
Signed by: TudbuT
GPG key ID: B3CF345217F202D3

View file

@ -17,6 +17,7 @@ import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Map;
@ -67,7 +68,7 @@ public class CustomClassLoader extends ClassLoader implements Util {
throw new IllegalStateException(MixinService.getService().getClass().toString());
}
Method m = Class.forName("java.lang.ClassLoader.ParallelLoaders").getDeclaredMethod("register", Class.class);
Method m = Arrays.stream(Class.forName("java.lang.ClassLoader").getDeclaredClasses()).filter(x -> x.getSimpleName().equalsIgnoreCase("ParallelLoaders")).findFirst().get().getDeclaredMethod("register", Class.class);
m.setAccessible(true);
m.invoke(null, CustomClassLoader.class);