Applications for --limit-modules?

Nicolai Parlog nipa at codefx.org
Sat Jan 28 18:39:03 UTC 2017


 Hi Alan,

thanks for your reply. Yes testing is a good example, didn't have that
idea. So testing and services, then?

> I guess this could be expanded a bit but it might be too much to 
> attempt to include text on how it interacts with other options.

Yes, interaction would be too much but I think it should say that only
the specified modules will be used as root modules.

> The set of observable modules is the the transitive closure of the 
> modules you specify to --limit-modules plus any modules that you 
> specify to --add-modules or -m (for the main/initial module).

Based on my observations that is not the case. At least the initial
module is _not_ used as a root module to determine the universe of
observable modules. This only works if bar is in foo's transitive closure:

	java -p mods --lomit-modules foo -m bar

> There's more on JEP 261 on this if you need it.

Oh, nice, I didn't look there.

 so long ... Nicolai



On 28.01.2017 18:22, Alan Bateman wrote:
> On 28/01/2017 14:34, Nicolai Parlog wrote:
> 
>> Hi!
>> 
>> I'm experimenting with --limit-modules and am not quite sure
>> what exactly it is good for.
> It's wonderful for testing.  Think `java --limit-module java.base
> -cp ...` to test an application running with just java.base rather
> than creating a minimal run-time image with jlink.
> 
> 
>> But before I come to that I want to make sure I got it right,
>> because I had to figure this out by trial and error (the current
>> output of java -? is not that helpful)
> --limit-modules <modulename>[,<modulename>...] limit the universe
> of observable modules
> 
> I guess this could be expanded a bit but it might be too much to
> attempt to include text on how it interacts with other options.
> 
>> 
>> I came to the conclusion that only the modules given to 
>> --limit-modules will be root modules for the resolution process.
>> This explicitly excludes the initial module so unless it is
>> listed as well or a transitive dependency of one of the ones that
>> were, the command will fail right away.
> The set of observable modules is the the transitive closure of the 
> modules you specify to --limit-modules plus any modules that you
> specify to --add-modules or -m (for the main/initial module).
> There's more on JEP 261 on this if you need it.
> 
> -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