Module.addOpens should log if the package has been opened for illegal access for the caller

Alan Bateman Alan.Bateman at oracle.com
Thu Dec 10 11:45:03 UTC 2020


On 10/12/2020 10:32, Johannes Kuhn wrote:
> :
>
> If a module has been reflectively opened, then no warning should 
> emitted, right.
> But reflectively opening a package should emit such a warning if you 
> can only do that because it has been opened to you for illegal access.

If --add-opens is used to open the package then there shouldn't be a 
warning. The reflective case may need more consideration. None of the 
standard or JDK modules should be doing this so there may be a case to 
not suppress the warning after VM initialization has completed. In other 
words, the addOpens in your example would be a no-op because java.net is 
already open for illegal reflection access.

-Alan



More information about the jigsaw-dev mailing list