Compiling with automatic modules

Alex Buckley alex.buckley at oracle.com
Tue May 23 20:30:09 UTC 2017


On 5/23/2017 12:54 PM, Stephan Herrmann wrote:
> The 2017-05-18 draft of JLS indicates that automatic modules are beyond the
> scope of JLS.
> I'm puzzled what that should mean for a compiler.
> At face value it seems to say that compilers need not care about automatic
> modules. Instead I'd expect JLS to state that the host system must be able
> to discover automatic modules "as if by invocation of
> ModuleFinder.of(Path...)." or similar.
>
> Which is it?

Can you quote the text of concern?

Automatic modules are not a source artifact, so their specification is 
found in the API portion of the JPMS spec rather than in the JLS. The 
JLS has traditionally not specified how a compiler interprets non-source 
artifacts, e.g., the JLS says nothing about whether the host system 
understands a "class path" or that such a thing might identify 
non-source artifacts like JAR files. The analog in the Java SE 9 era is 
that it's up to a compiler to choose to support a thing called the 
"module path" and to identify non-source artifacts on it; I do not see 
how the JLS can say anything for that. Once a compiler has made the 
choice, then the JPMS specifies that certain non-source artifacts must 
be interpreted as automatic modules, at which point they're "just" named 
modules that a modular compilation unit's 'requires' directive can refer to.

Alex


More information about the jigsaw-dev mailing list