On 06/01/2021 19:15, Thiago Henrique Hupner wrote:
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.

I'm not aware of any issues in this area. Can you create a test case as that might be easier to discuss? (I'm guessing the module names aren't "module.a" and "module.b" as that won't compile. Also I would expect this type of patching to emit a warning that the module-info.class in module-b.jar is ignored).

-Alan

Reply via email to