Re: IllegalAccessError with --patch-module

2021-01-06 Thread Johannes Kuhn
Indeed a bug. Happens under the following conditions: * Patched module is an automatic module * Patch adds one or more additional packages to the module. Cause are the following lines: https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/jdk/internal/module/ModulePatcher.java#L

Re: IllegalAccessError with --patch-module

2021-01-06 Thread Thiago Henrique Hupner
This is getting very confusing. If you use any jar as an automatic module in the "--module-path" (-p) and add the main class in another jar (in this example jar-b.jar), patch both and the error happens. The main class is literally just an empty main method [1]. The error happens even if we use an

Re: IllegalAccessError with --patch-module

2021-01-06 Thread Alan Bateman
On 06/01/2021 19:57, Thiago Henrique Hupner wrote: Sorry, they are automatic modules. I'll create a test case. Also if you can include the output with --show-module-resolution then it might help track this down quickly (running without any explicit modules on the module path is, on the surfac

Re: IllegalAccessError with --patch-module

2021-01-06 Thread Thiago Henrique Hupner
Sorry, they are automatic modules. I'll create a test case. Em qua., 6 de jan. de 2021 às 16:56, Alan Bateman escreveu: > 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 wit

Re: IllegalAccessError with --patch-module

2021-01-06 Thread Alan Bateman
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

IllegalAccessError with --patch-module

2021-01-06 Thread Thiago Henrique Hupner
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: Unab