Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
-
None
-
None
Description
Support for -Djava.system.class.loader=org.codehaus.groovy.tools.RootLoader is missing for Java 12+. The constructor that accepts ClassLoader is private. See code excerpt below that tries to call this constructor using reflection.
java.lang.ClassLoader
static synchronized ClassLoader initSystemClassLoader() { // ... String cn = System.getProperty("java.system.class.loader"); if (cn != null) { try { // custom class loader is only supported to be loaded from unnamed module Constructor<?> ctor = Class.forName(cn, false, builtinLoader) .getDeclaredConstructor(ClassLoader.class); scl = (ClassLoader) ctor.newInstance(builtinLoader);
java.lang.Error: class java.lang.ClassLoader (in module java.base) cannot access a member of class org.codehaus.groovy.tools.RootLoader with modifiers "private" at java.lang.ClassLoader.initSystemClassLoader(java.base@12.0.2/ClassLoader.java:1989) at java.lang.System.initPhase3(java.base@12.0.2/System.java:2132) Caused by: java.lang.IllegalAccessException: class java.lang.ClassLoader (in module java.base) cannot access a member of class org.codehaus.groovy.tools.RootLoader with modifiers "private" at jdk.internal.reflect.Reflection.newIllegalAccessException(java.base@12.0.2/Reflection.java:376) at java.lang.reflect.AccessibleObject.checkAccess(java.base@12.0.2/AccessibleObject.java:639) at java.lang.reflect.Constructor.newInstanceWithCaller(java.base@12.0.2/Constructor.java:490) at java.lang.reflect.Constructor.newInstance(java.base@12.0.2/Constructor.java:481) at java.lang.ClassLoader.initSystemClassLoader(java.base@12.0.2/ClassLoader.java:1977) at java.lang.System.initPhase3(java.base@12.0.2/System.java:2132)