RFR: JDK-8220702: compiling in the context of an automatic module disallows --add-modules ALL-MODULE-PATH
Alex Buckley
alex.buckley at oracle.com
Thu Apr 11 18:28:00 UTC 2019
On 4/11/2019 1:19 AM, Jan Lahoda wrote:
> Yes, I think JEP 261 may need updates. I'd say this is somewhat
> unforeseen interaction between automatic modules and --patch-module.
>
> When patching a (named) module (or a set of named modules), that module
> (or modules) become the root module for javac, and the ordinary module
> graph building algorithm is then used to build the module graph. So the
> set of modules in the module graph may be different from the set of the
> modules in the module graph when compiling source in the unnamed module.
OK. It sounds like (i) single-module mode supports source files being
compiled as if members of a named module (the module being patched), and
(ii) multi-module mode supports source files being compiled as if
members of named modules (the modules being patched). Great.
Broadly, JEP 261 is correct when it says this in "Root modules":
-----
Otherwise, the default set of root modules depends upon the phase:
- At compile time it is usually the set of modules being compiled (more
on this below);
-----
where "below", it is correct for multi-module mode:
-----
The set of root modules is the set of modules for which at least one
source file is specified.
-----
but incorrect for single-module mode: (assuming javac is invoked as
shown in your first mail)
-----
Otherwise source files will be compiled as members of the unnamed
module, and the root modules will be computed as described above.
-----
JEP 261 is the ultimate source of truth for the module system, from
which all tutorials, blogs, books, etc derive. It's very hard to infer
from it that javac supports compiling source as if in a patched module.
That's why a CSR to record what javac does (either with no --add-modules
or with --add-modules=ALL-MODULE-PATH) will be so valuable. In advance
of that, can you share some detailed invocations of javac using
--patch-module in single-module and multi-module mode?
Alex
More information about the jigsaw-dev
mailing list