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 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
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.
Interface | Description |
---|---|
ModuleFinder |
A finder of modules.
|
ModuleReader |
Provides access to the content of a module.
|
Class | Description |
---|---|
Configuration |
A configuration that is the result of
resolution or resolution with
service binding.
|
ModuleDescriptor |
A module descriptor.
|
ModuleDescriptor.Builder |
A builder for building
ModuleDescriptor objects. |
ModuleDescriptor.Exports |
A package exported by a module, may be qualified or unqualified.
|
ModuleDescriptor.Opens |
A package opened by a module, may be qualified or unqualified.
|
ModuleDescriptor.Provides |
A service that a module provides one or more implementations of.
|
ModuleDescriptor.Requires |
A dependence upon a module
|
ModuleDescriptor.Version |
A module's version string.
|
ModuleReference |
A reference to a module's content.
|
ResolvedModule |
A module in a graph of resolved modules.
|
Enum | Description |
---|---|
ModuleDescriptor.Exports.Modifier |
A modifier on an exported package.
|
ModuleDescriptor.Modifier |
A modifier on a module.
|
ModuleDescriptor.Opens.Modifier |
A modifier on an open package.
|
ModuleDescriptor.Requires.Modifier |
A modifier on a module dependence.
|
Exception | Description |
---|---|
FindException |
Thrown by a
ModuleFinder when an error occurs finding
a module. |
InvalidModuleDescriptorException |
Thrown when reading a module descriptor and the module descriptor is found
to be malformed or otherwise cannot be interpreted as a module descriptor.
|
ResolutionException |
Thrown when resolving a set of modules, or resolving a set of modules with
service binding, fails.
|
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