register parallel capability at the right time
All checks were successful
/ Build BaseBand Loader (push) Successful in 1m12s

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

View file

@ -28,6 +28,16 @@ public class CustomClassLoader extends ClassLoader implements Util {
private final DataKeeper<Map<String, byte[]>> binaryKeeper;
private final DataKeeper<PermissionManager> mixinPermissionManager;
static {
try {
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);
} catch (Exception e) {
throw new RuntimeException("unable to patch ClassLoader", e);
}
}
public CustomClassLoader(Map<String, byte[]> data) {
AccessKiller.killReflectionFor(CustomClassLoader.class, CustomMixinServer.class);
@ -68,10 +78,6 @@ public class CustomClassLoader extends ClassLoader implements Util {
throw new IllegalStateException(MixinService.getService().getClass().toString());
}
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);
Field parent = ClassLoader.class.getDeclaredField("parent");
parent.setAccessible(true);
parent.set(this, parent.get(Launch.classLoader));