Why is -XD-Xmodule hidden?

Nicolai Parlog nipa at codefx.org
Sun Jun 11 07:57:44 UTC 2017


 Hi Alan,

thanks for the quick reply. Unfortunately I could not get it to work
with --patch-module (I tried before finding -XD-Xmodule).

Maybe I'm doing something wrong? I'm using a JPMS demo project I
developed[1]. I get the expected compilation errors when doing this:

javac --module-path mods -d classes \
	monitor.rest/src/main/java/monitor/rest/MonitorServer.java

It works with -XD-Xmodule:

javac --module-path mods -d classes \
	XD-Xmodule monitor.rest
	monitor.rest/src/main/java/monitor/rest/MonitorServer.java

With --patch-module I get the same errors as without:

javac --module-path mods -d classes \
	--patch-module monitor.rest=mods/monitor.rest.jar \
	monitor.rest/src/main/java/monitor/rest/MonitorServer.java

Also, it looks like the option is not even really processed. If using
a non-existent module name or JAR or even if I add some additional
equal signs, I get no particular error for that.

I'm on ea-172-Jigsaw.

 so long ... Nicolai


[1] https://github.com/CodeFX-org/demo-jpms-monitor ;
    it can be built with the contained compile.sh or multi-compile.sh
    (maybe after removing the 9's from the commands)



On 11.06.2017 09:35, Alan Bateman wrote:
> On 11/06/2017 08:13, Nicolai Parlog wrote:
>> Hi!
>> 
>> When incrementally compiling some of a module's sources it is
>> necessary to make the compiler aware that the sources actually
>> belong to that module. One way to do this was the non-standard
>> option -Xmodule, which was recently demoted to the hidden
>> -XD-Xmodule.
>> 
>> I'm curious to know why.
>> 
>> Example:
>> 
>> javac --module-path mods -d classes 
>> src/foo.mod/com.example.SomeClass.java
>> 
>> This will compile SomeClass in the unnamed module, making it fail
>> if it uses types from bar.mod (even if foo.mod requires it).
>> 
>> I know of three ways to fix this:
>> 
>> * adding module declaration to compile command * multi-module
>> declaration * option -XD-Xmodule
>> 
>> I found the last option to be conceptually most fitting and also
>> the least troublesome.
>> 
> -Xmodule was folded into --patch-module some time ago. Just add 
> `--patch-module foo.mod=src/foo.jmod` to the above.
> 
> I'll have to defer to Jon or Jan as to why -Xmodule wasn't removed.
> As I recall, it was made hidden to allow for transition but I
> thought that was temporary.
> 
> -Alan
> 

-- 

PGP Key:
    http://keys.gnupg.net/pks/lookup?op=vindex&search=0xCA3BAD2E9CCCD509

Web:
    http://codefx.org
        a blog about software development
    https://www.sitepoint.com/java
        high-quality Java/JVM content
    http://do-foss.de
        Free and Open Source Software for the City of Dortmund

Twitter:
    https://twitter.com/nipafx


More information about the jigsaw-dev mailing list