Combining -Xmodule and --add-reads

Alan Bateman Alan.Bateman at oracle.com
Tue Aug 23 14:51:19 UTC 2016


On 23/08/2016 15:23, Sander Mak wrote:

> :
> Thanks Alan, that did the trick. Apparently this behavior changed for javac. Executing the test runs fine without --add-modules on org.junit, though:
>
> java --patch-module undertest=mod-test \
>       --add-reads undertest=org.junit \
>       --add-exports undertest/undertest.mytestpackage=org.junit \
>       --module-path mods:lib-test \
>       --add-modules undertest,hamcrest.core \
>       -m org.junit/org.junit.runner.JUnitCore undertest.mytestpackage.WhiteboxTest
>
> (hamcrest.core needs to be added explicitly since it's neither required nor used in --add-reads)
The initial module is org.junit so it will be resolved.



> In any case, the omission of `--add-modules` was hard to debug without an error message pointing out that --add-reads was referencing a non-resolved module.
>
Right, this is where the javac handling differs and will be exposed once 
we have better tests to compare javac + runtime behavior for cases like 
this.

-Alan


More information about the jigsaw-dev mailing list