Modules and build time

mark.reinhold at oracle.com mark.reinhold at oracle.com
Thu Dec 10 01:28:45 UTC 2015


2015/10/21 4:21 -0700, david.lloyd at redhat.com:
> I have a problem with the premise that modules should be directly 
> consumable by the build in the same way they are consumed at run time.
> Building a typical Java artifact today generally entails the Maven 
> approach, which, roughly translated into modularisms, would look 
> something like this:
> 
> * We build artifacts, not modules
> * The build consumes (specific versions of) modules for build tasks such 
> as resource processing, descriptor generation, annotation processing, etc.
> * The build consumes (specific versions of) artifacts for the build 
> class path; these artifacts generally correspond to a minimum version of 
> a module that is expected to be mandatorily or optionally present at run 
> time, but also may correspond only to specific APIs expected to be 
> present at run time
> * The run time environment may consist of a set of modules that does not 
> have a direct correspondence to the artifacts used for build
> * The test time environment may consist of a set of modules that does 
> not have a direct correspondence to the artifacts used for build
> 
> To me there is no sensible way to reconcile these facts against the 
> proposed Jigsaw methodology of having javac reference modules directly. 
>   This would mean that all build artifacts have to be packaged as 
> modules and transported to the user for build, which further means that 
> every user would need to define a complete, build-specific modular 
> environment, ...

I'm not completely sure what you're getting at here, but it's not the
case that all of the modules needed to run a particular module must be
present to compile that module.  The compiler only needs to resolve the
immediate and implied read edges of the module(s) being compiled.  If
module A requires B, and B requires C, then the compiler can compile A
without inspecting C.  If B requires public C, however, then the compiler
must inspect C also, and therefore resolve it.  All of this follows from
the definitions of readability and implied readability.

- Mark


More information about the jpms-spec-experts mailing list