IllegalAccessError with --patch-module

Alan Bateman Alan.Bateman at oracle.com
Thu Jan 7 10:01:48 UTC 2021


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.

-Alan.


More information about the jigsaw-dev mailing list