IllegalAccessError with --patch-module

Thiago Henrique Hupner thihup at gmail.com
Wed Jan 6 19:15:03 UTC 2021


Hi!

I've noticed something strange, but I don't know if it is a bug:
If we have two jars:
module.a with the class com.foo.Bar
module.b with the classes com.foo.Bar and com.foo.Main.

Running:
java -p module-a.jar --patch-module=module.a=module-b.jar -m
module.a/com.foo.Main

it throws:
Error: Unable to load main class com.foo.Main in module module.a
        java.lang.IllegalAccessError: superclass access check failed: class
com.foo.Main (in module module.a) cannot access class java.lang.Object (in
module java.base) because module java.base does not export java.lang to
module module.a

Even with --add-exports=java.base/java.lang=module.a it doesn't work.

Is this a bug? I have a real usage where the main class is the "patched"
module to override the com.foo.Bar.

Thanks!


More information about the jigsaw-dev mailing list