[
https://issues.apache.org/jira/browse/GROOVY-10164?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Paul King closed GROOVY-10164.
------------------------------
> RootLoader cannot be set as system class loader in Java 12+
> -----------------------------------------------------------
>
> Key: GROOVY-10164
> URL: https://issues.apache.org/jira/browse/GROOVY-10164
> Project: Groovy
> Issue Type: Bug
> Reporter: Eric Milles
> Assignee: Eric Milles
> Priority: Minor
> Fix For: 4.0.0-beta-1, 3.0.9, 2.5.16
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> 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
> {code:java}
> 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);
> {code}
> {code}
> 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([email protected]/ClassLoader.java:1989)
> at java.lang.System.initPhase3([email protected]/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([email protected]/Reflection.java:376)
> at
> java.lang.reflect.AccessibleObject.checkAccess([email protected]/AccessibleObject.java:639)
> at
> java.lang.reflect.Constructor.newInstanceWithCaller([email protected]/Constructor.java:490)
> at
> java.lang.reflect.Constructor.newInstance([email protected]/Constructor.java:481)
> at
> java.lang.ClassLoader.initSystemClassLoader([email protected]/ClassLoader.java:1977)
> at java.lang.System.initPhase3([email protected]/System.java:2132)
> {code}
--
This message was sent by Atlassian Jira
(v8.20.1#820001)