Skip to content

Commit

Permalink
Fix #25 and MinecraftForge/MinecraftForge#5735 by not using the deleg…
Browse files Browse the repository at this point in the history
…ated classloader to find loaded classes anymore.

Signed-off-by: cpw <cpw+github@weeksfamily.ca>
  • Loading branch information
cpw committed May 12, 2019
1 parent 0297c43 commit f622c62
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundE
}

public Class<?> getLoadedClass(String name) {
return delegatedClassLoader.getLoadedClass(name);
return findLoadedClass(name);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ public List<ITransformer> transformers() {
final Class<?> aClass = Class.forName("cheese.Puffs", true, tcl);
assertEquals(Whitebox.getField(aClass, "testfield").getType(), String.class);
assertEquals(Whitebox.getField(aClass, "testfield").get(null), "CHEESE!");

final Class<?> newClass = tcl.loadClass("cheese.Puffs");
assertEquals(aClass, newClass, "Class instance is the same from Class.forName and tcl.loadClass");
}

private static class ClassNodeTransformer implements ITransformer<ClassNode> {
Expand Down

0 comments on commit f622c62

Please sign in to comment.