-
Enhancement
-
Resolution: Unresolved
-
P4
-
None
-
None
We have come across situations where IllegalAccessErrors of the following kind were seen:
java.lang.IllegalAccessError: class org.graalvm.jniutils.JNI$JNIInvokeInterface (in module org.graalvm.jniutils) cannot access class org.graalvm.jniutils.JNI (in module org.graalvm.jniutils) because module org.graalvm.jniutils does not read module org.graalvm.jniutils
at java.base/java.lang.Class.getDeclaringClass0(Native Method)
If we would not have known from the context where we were getting these, it might have been hard to come to the conclusion that the error message refers to modules named "org.graalvm.jniutils", that were loaded by different classloaders. I.e. although having the same name, they are different modules. From the error message we cannot make out that the first mention of module org.graalvm.jniutils does not refer to the same module as the second mention.
In such cases it would be very helpful to either
* add an additional sentence that explains that those modules belong to different classloaders
* or to prefix the module names with "@" + Integer.toHexString(hashCode()) so that it is easy to see that they are not the same.
A similar issue was also reported previously asJDK-8199940.
java.lang.IllegalAccessError: class org.graalvm.jniutils.JNI$JNIInvokeInterface (in module org.graalvm.jniutils) cannot access class org.graalvm.jniutils.JNI (in module org.graalvm.jniutils) because module org.graalvm.jniutils does not read module org.graalvm.jniutils
at java.base/java.lang.Class.getDeclaringClass0(Native Method)
If we would not have known from the context where we were getting these, it might have been hard to come to the conclusion that the error message refers to modules named "org.graalvm.jniutils", that were loaded by different classloaders. I.e. although having the same name, they are different modules. From the error message we cannot make out that the first mention of module org.graalvm.jniutils does not refer to the same module as the second mention.
In such cases it would be very helpful to either
* add an additional sentence that explains that those modules belong to different classloaders
* or to prefix the module names with "@" + Integer.toHexString(hashCode()) so that it is easy to see that they are not the same.
A similar issue was also reported previously as
- relates to
-
JDK-8199940 Print more information about class loaders in IllegalAccessErrors
-
- Resolved
-