IllegalAccessError with --patch-module

Johannes Kuhn info at j-kuhn.de
Thu Jan 7 13:06:47 UTC 2021



On 07-Jan-21 11:01, Alan Bateman wrote:
> On 06/01/2021 23:49, Johannes Kuhn wrote:
>> Indeed a bug.
>>
>> Happens under the following conditions:
>> * Patched module is an automatic module
>> * Patch adds one or more additional packages to the module.
>>
>> :
>>
>> Proposed fix:
>> * Change requires to not check if it is an automatic module if the 
>> builder is not strict.
>> * Move the copying of the requires out of the if.
> 
> Thanks for the mails, it is bug. The additional information that the 
> patch adds packages to the automatic module was important to understand 
> the mails. One other thing is that the bug does not surface when the set 
> of root modules includes an explicit module or an unpatched automatic 
> module. So very obscure scenario that probably explains why there hasn't 
> been reported before now.
> 
> The patcher should be using strict mode when re-building the module 
> descriptor for a patched automatic modules. The non-strict mode is for 
> explicit modules as the identifiers (that may not be valid in the Java 
> Language) are read from the module-info.class. I'll create a bug for this.

Even better fix.

To be honest - I don't quite understand the bug - but I was able to 
reproduce it.
So I did manually retrace the code to see where the difference was 
happening, and found the lines above - which was "good enough" for an 
explanation.

Is there a way to debug the early java initialization? I didn't got that 
working, so had to do it by hand.

> 
> -Alan.

- Johannes


More information about the jigsaw-dev mailing list