Combining -Xmodule and --add-reads

Sander Mak sander.mak at luminis.eu
Tue Aug 23 12:02:11 UTC 2016


Hi,

In previous builds this idiom for compiling (whitebox) tests worked for me:

javac -Xmodule:undertest \
      -XaddReads:undertest=org.junit \
      -mp mods:lib-test \
      -d mods-test/undertest $(find src-test -name '*.java')

Compile the test classes as if they were part of the module 'undertest', then patch the undertest module at runtime and launch the JUnit runner (not shown here). Mods dir contains 'undertest' as exploded module and lib-test contains 'org.junit.jar' and 'hamcrest-core-1.3.jar', to be used as automatic modules in this case.

I tried to re-write this setup to the new command-line flags on 9-ea+131-jigsaw-nightly-h5400-20160818:

javac -Xmodule:undertest \
      --add-reads undertest=org.junit \
      --module-path mods:lib-test \
      -d mods-test/undertest $(find src-test -name '*.java')

To my surprise, this yields compilation errors telling me that package 'org.junit' does not exist. Somehow, it seems like the add-reads is failing. Or maybe something else is wrong, but I'm missing it.

Incidentally, when I change the add-reads to something like '--add-reads obvious=nonsense' it still gives the same errors. I'd expect a warning/error that the arguments to --add-reads are invalid in that case. I also tried falling back to the original -XaddReads:undertest=org.junit syntax with the same results.


Thanks,
Sander



More information about the jigsaw-dev mailing list