JOL is broken on module path
Zheka Kozlov
orionllmain at gmail.com
Sat Apr 17 11:19:30 UTC 2021
Hi!
javac cannot compile a Java project with module-info.java that requires JOL:
module <module> {
requires jol.core;
}
Error: the unnamed module reads package java.lang from both java.base and
jol.core
The problem is the class JOLUnsafeTrampoline which is in the java.lang
package. This causes a split package error.
I propose the following simple solution. Since the class is injected via
Unsafe::defineAnonymousClass, we can put it anywhere in the JAR. For
example, we can put it in the root without the .class extension (so Java
will not treat it as a class file).
What do you think?
More information about the jol-dev
mailing list