Why is -XD-Xmodule hidden?

Jonathan Gibbons jonathan.gibbons at oracle.com
Sun Jun 11 15:26:57 UTC 2017



On 6/11/17 12:35 AM, 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.
>

There are some tests which still need to be changed to use 
--patch-module.  Once all uses of -Xmodule have been removed from tests, 
we will remove the (hidden/undocumented) option.

-- Jon

> -Alan



More information about the jigsaw-dev mailing list