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 20:40:37 UTC 2019


On 4/11/2019 12:00 PM, Christian Stein wrote:
> I'm not sure if this helps in any regards -- here [1] is a draft PR
> that adds explicit module descriptors to all JUnit 5 modules.
>
> This PR uses javac in multi-module mode and --patch-module
> to access the already (with --release 8) compiled classes of
> each module.

Thanks Christian. Ultimately you're invoking javac like so:

javac --patch-module org.junit.platform.commons=
                      junit-platform-commons/build/classes/java/main
       --module-version 1.5.0-SNAPSHOT
       src/modules/org.junit.platform.commons/module-info.java

where it is interesting to see --patch-module indicating the putative 
content of a module before the module-info.java file which declares the 
module into existence has been compiled!

You even get the benefit of error-checking for module-info.java, e.g., 
that its `exports` refer to packages which truly exist in the module. I 
suppose if you just put junit-platform-commons/build/classes/java/main 
on the --module-path then you would not get this checking.

The first point for using --patch-module at compile time goes to Jan for 
building tests as if members of automatic modules; you get the second 
point for building module declarations as if members of ... well, 
themselves.

Alex


More information about the jigsaw-dev mailing list