Please note that the specifications and other information contained herein are not final and are subject to change. The information is being made available to you solely for purpose of evaluation.
Java™ Platform
Standard Ed. 9

DRAFT 9-internal+0-adhoc.mlchung.jdk9-jdeps
Module java.base

Package java.lang.module

Classes to support module descriptors and creating configurations of modules by means of resolution and service binding.


Resolution is the process of computing the transitive closure of a set of root modules over a set of observable modules by resolving the dependences expressed by requires clauses. The dependence graph is augmented with edges that take account of implicitly declared dependences (requires transitive) to create a readability graph. The result of resolution is a Configuration that encapsulates the readability graph.

As an example, suppose we have the following observable modules:

     module m1 { requires m2; }
     module m2 { requires transitive m3; }
     module m3 { }
     module m4 { }

If the module m1 is resolved then the resulting configuration contains three modules (m1, m2, m3). The edges in its readability graph are:

     m1 --> m2  (meaning m1 reads m2)
     m1 --> m3
     m2 --> m3

Resolution is an additive process. When computing the transitive closure then the dependence relation may include dependences on modules in parent configurations. The result is a relative configuration that is relative to one or more parent configurations and where the readability graph may have edges from modules in the configuration to modules in parent configurations.

As an example, suppose we have the following observable modules:

     module m1 { requires m2; requires java.xml; }
     module m2 { }

If module m1 is resolved with the configuration for the boot layer as the parent then the resulting configuration contains two modules (m1, m2). The edges in its readability graph are:

     m1 --> m2
     m1 --> java.xml
where module java.xml is in the parent configuration. For simplicity, this example omits the implicitly declared dependence on the java.base module.

Requires clauses that are "requires static" express an optional dependence (except at compile-time). If a module declares that it "requires static M" then resolution does not search the observable modules for "M". However, if "M" is resolved (because resolution resolves a module that requires "M" without the static modifier) then the readability graph will contain read edges for each module that "requires static M".

Automatic modules receive special treatment during resolution. Each automatic module is resolved so that it reads all other modules in the configuration and all parent configurations. Each automatic module is also resolved as if it "requires transitive" all other automatic modules in the configuration (and all automatic modules in parent configurations).

Service binding

Service binding is the process of augmenting a graph of resolved modules from the set of observable modules induced by the service-use dependence (uses and provides clauses). Any module that was not previously in the graph requires resolution to compute its transitive closure. Service binding is an iterative process in that adding a module that satisfies some service-use dependence may introduce new service-use dependences.

Suppose we have the following observable modules:

     module m1 { exports p; uses p.S; }
     module m2 { requires m1; provides p.S with p2.S2; }
     module m3 { requires m1; requires m4; provides p.S with p3.S3; }
     module m4 { }

If the module m1 is resolved then the resulting graph of modules has one module (m1). If the graph is augmented with modules induced by the service-use dependence relation then the configuration will contain four modules (m1, m2, m3, m4). The edges in its readability graph are:

     m2 --> m1
     m3 --> m1
     m3 --> m4

The edges in the conceptual service-use graph are:

     m1 --> m2  (meaning m1 uses a service that is provided by m2)
     m1 --> m3

General Exceptions

Unless otherwise noted, passing a null argument to a constructor or method of any class or interface in this package will cause a NullPointerException to be thrown. Additionally, invoking a method with an array or collection containing a null element will cause a NullPointerException, unless otherwise specified.

Skip navigation links
Java™ Platform
Standard Ed. 9

DRAFT 9-internal+0-adhoc.mlchung.jdk9-jdeps

Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2017, Oracle and/or its affiliates. 500 Oracle Parkway
Redwood Shores, CA 94065 USA. All rights reserved.

DRAFT 9-internal+0-adhoc.mlchung.jdk9-jdeps