named or unnamed.
Named modules have a name and are constructed by the
Java Virtual Machine when a graph of modules is defined to the Java virtual
machine to create a module layer.
An unnamed module does not have a name. There is an unnamed module for
each ClassLoader, obtained by invoking its getUnnamedModule method. All types that are
not in a named module are members of their defining class loader's unnamed
module.
The package names that are parameters or returned by methods defined in
this class are the fully-qualified names of the packages as defined in
section 6.5.3 of The Java Language Specification, for
example, "java.lang".
Unless otherwise specified, passing a null argument to a method
in this class causes a NullPointerException to
be thrown.
Class#getModule()
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| private static class | Module.
This class exists to avoid using Unsafe during early initialization of Module. |
| private static class | Module.
This class is used to be able to bootstrap without using Unsafe in the outer Module class as that would create a circular initializer dependency. |
| private static class | Module.
The holder of data structures to support readability, exports, and service use added at runtime with the reflective APIs. |
| Modifier and Type | Field and Description |
|---|---|
| private static final Module | |
| private static final Set | |
| private final ModuleDescriptor | |
| private boolean | |
| private boolean | |
| private static final Module | |
| private static final Set | |
| private volatile Map | |
| private final ModuleLayer | |
| private final ClassLoader | |
| private volatile Class | |
| private final String | |
| private volatile Map | |
| private volatile Set |
| Access | Constructor and Description |
|---|---|
| pack-priv | Module(ModuleLayer layer, ClassLoader loader, ModuleDescriptor descriptor, URI uri)
Creates a new named Module. |
| pack-priv | |
| pack-priv | Module(ClassLoader loader, ModuleDescriptor descriptor)
Creates a named module but without defining the module to the VM. |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv static void | addEnableFinalMutationToAllUnnamed()
Enable code in all unnamed modules to mutate final instance fields. |
| pack-priv static void | |
| public Module | Returns: this moduleThe package name pn, Module The module other)If the caller's module is this module then update this module to export the given package to the given module. |
| private static native void | |
| private static native void | |
| private static native void | |
| public Module | |
| public Module | |
| private static native void | |
| public Module | |
| private boolean | |
| public boolean | |
| public boolean | |
| private static native void | |
| pack-priv static Map | Returns: a map of module name to runtimeModuleDefines all module in a configuration to the runtime. |
| pack-priv void | |
| private static Module | findModule(ModuleLayer parent, ResolvedModule resolvedModule)
Find the runtime Module corresponding to the given ResolvedModule in the given parent layer (or its parents). |
| private static Module | findModule(String
The target module to find target, Map<String, Module> The modules in parent layers that are read nameToSource, Map<String, Module> The modules in the layer under construction nameToModule, List<ModuleLayer> The parent layers parents)Find the runtime Module with the given name. |
| public <T extends Annotation> T | getAnnotation(Class<T> annotationClass)
Implements java. Returns this element's annotation for the specified type if such an annotation is present, else null. |
| public Annotation[] | getAnnotations()
Implements java. Returns annotations that are present on this element. |
| private Module | |
| public ClassLoader | |
| public Annotation[] | getDeclaredAnnotations()
Implements java. Returns annotations that are directly present on this element. |
| public ModuleDescriptor | Returns: The module descriptor for this moduleReturns the module descriptor for this module or |
| public ModuleLayer | Returns: The module layer that contains this moduleReturns the module layer that contains this module or |
| public String | Returns: The module nameReturns the module name or |
| public Set | Returns: the set of the package names of the packages in this moduleReturns the set of package names for the packages in this module. |
| public InputStream | Returns: An input stream for reading the resource ornullThe resource name name)Returns an input stream for reading a resource in this module. |
| pack-priv Module | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | implAddExportsNoSync(String pn)
Updates this export to export a package unconditionally without notifying the VM. |
| pack-priv void | implAddExportsNoSync(String pn, Module other)
Updates a module to export a package to another module without notifying the VM. |
| private void | implAddExportsOrOpens(String
package name pn, Module the module to export/open the package to other, boolean true to open, false to export open, boolean true if exported/opened reflectively reflectively, boolean true to update the VM syncVM)Updates a module to export or open a module to another module. |
| pack-priv void | implAddExportsToAllUnnamed(String pn)
Updates this module to export a package to all unnamed modules. |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| private void | |
| pack-priv void | |
| pack-priv void | implAddReadsNoSync(Module other)
Updates this module to read another module without notifying the VM. |
| pack-priv void | implAddUses(Class<?> service)
Update this module to add a service dependence on the given service type. |
| private boolean | implIsExportedOrOpen(String pn, Module other, boolean open)
Returns |
| private static void | initExports(Module
the module m, Map<String, Module> map of module name to Module (for qualified exports) nameToModule)Initialize/setup a module's exports. |
| private static void | initExportsAndOpens(Module
the module m, Map<String, Module> map of module name to Module for modules that m reads nameToSource, Map<String, Module> map of module name to Module for modules in the layer
under construction nameToModule, List<ModuleLayer> the parent layers parents)Initialize/setup a module's exports. |
| private boolean | isExplicitlyExportedOrOpened(String pn, Module other, boolean open)
Returns |
| public boolean | Returns: true if this module exports the package to at least the
given moduleThe package name pn, Module The other module other)Returns |
| public boolean | Returns: true if this module exports the package unconditionallyThe package name pn)Returns |
| pack-priv boolean | isFinalMutationEnabled()
Return true if code in this module is allowed to mutate final instance fields. |
| public boolean | |
| public boolean | Returns: true if this module can access restricted methods.Returns |
| public boolean | |
| public boolean | |
| pack-priv boolean | isReflectivelyExported(String pn, Module other)
Returns |
| private boolean | isReflectivelyExportedOrOpened(String pn, Module other, boolean open)
Returns |
| pack-priv boolean | isReflectivelyOpened(String pn, Module other)
Returns |
| pack-priv boolean | isStaticallyExported(String pn, Module other)
Returns |
| private boolean | isStaticallyExportedOrOpened(String pn, Module other, boolean open)
Returns |
| pack-priv boolean | isStaticallyOpened(String pn, Module other)
Returns |
| private Class | |
| private Class | loadModuleInfoClass(InputStream in)
Loads module-info.class as a package-private interface in a class loader that is a child of this module's class loader. |
| private Module | |
| private Class | |
| public String | Returns: The string representation of this moduleOverrides java. Returns the string representation of this module. |
| pack-priv boolean |