Modules and javac

Alex Buckley Alex.Buckley at Sun.COM
Fri Apr 10 15:24:55 PDT 2009


This mail concerns the Reference Implementation of JSR 294, rather than 
the Jigsaw module system.

* Introduction

The Java Language Specification (JLS) defines the syntax and semantics 
of the Java programming language. It does not mention "javac". It speaks 
of a "host system" which is required to make compilation units ("source 
files") observable and report compile-time errors. The physical 
locations of compilation units and the text of compile-time errors are 
left as implementation details of the host system.

javac is the Reference Implementation of a compiler for the Java 
programming language. javac embodies a "host system", and has 
implementation-specific features such as "class path" ($CLASSPATH and 
-classpath) that are not defined by any JCP specification, including the 
JLS.

* javac and JSR 294

JSR 294 defines Java language features for modularity. These language 
features are module dependencies and accessibility. Both imply that the 
module to which a compilation unit belongs is known at compile-time. For 
such a module, the host system must determine the physical location of 
its module compilation unit ("module-info").

The attached presentation examines how to extend javac to locate 
module-info files, whether compiling source for one module or multiple 
modules. The key insight is that javac's "class path" mechanism should 
be augmented with a "module path" mechanism.

Like "class path", "module path" is an implementation detail of the host 
system. A further implementation detail is that javac may, depending on 
its configuration, consult a module system to a) obtain classes from a 
module library, and b) obtain help in selecting one version of a module 
when multiple versions are available.

Alex


More information about the jigsaw-dev mailing list