RFR: JDK-8220702: compiling in the context of an automatic module disallows --add-modules ALL-MODULE-PATH

Jan Lahoda jan.lahoda at oracle.com
Tue Apr 9 11:43:19 UTC 2019


Hi,

Currently, when compiling an unnamed module, --add-modules 
ALL-MODULE-PATH adds all modules from the module path to the module 
graph, so that the unnamed module can refer to them.

When compiling a named module, this option is not allowed, as it would 
be confusing, as it cannot modify the dependencies of the named module.

But, when compiling a code in the context of an automatic module using 
--patch-module, e.g.:
javac --module-path <automatic-module> --patch-modules 
<automatic-module-name>=<dir> ...

The --add-modules ALL-MODULE-PATH is still disallowed, but it may make 
sense to use it, as it may affect the set of classes available for the 
sources that are being compiled. Compiling in the context of an 
automatic module may be useful esp. in when patching multiple modules at 
once (which is supported by --patch-module), e.g. to build tests. (Seems 
that also at least the use of javadoc in Maven may lead to a similar 
setting as well, see the JBS bug.)

The proposal is to allow the --add-modules ALL-MODULE-PATH option when 
compiling code in the context of an automatic module.

Proposed patch: http://cr.openjdk.java.net/~jlahoda/8220702/webrev.01/
JBS: https://bugs.openjdk.java.net/browse/JDK-8220702

What do you think?

Thanks,
     Jan


More information about the compiler-dev mailing list