APIdia Launch Partner
Top Description Inners Fields Constructors Methods
jdk.tools.jlink.internal.plugins

public final Class SystemModulesPlugin

extends AbstractPlugin
Class Inheritance
Imports
java.io.ByteArrayInputStream, .ByteArrayOutputStream, .IOException, .InputStream, java.lang.constant.ClassDesc, .MethodTypeDesc, java.lang.module.Configuration, .ModuleDescriptor, .ModuleDescriptor.Exports, .ModuleDescriptor.Opens, .ModuleDescriptor.Provides, .ModuleDescriptor.Requires, .ModuleFinder, .ModuleReader, .ModuleReference, .ResolvedModule, java.lang.reflect.ClassFileFormatVersion, java.net.URI, java.util.ArrayList, .Collection, .Collections, .EnumSet, .HashMap, .HashSet, .LinkedHashMap, .List, .Map, .Objects, .Optional, .Set, .TreeMap, .TreeSet, java.util.function.Supplier, java.util.stream.Collectors, jdk.internal.module.Checks, .DefaultRoots, .Modules, .ModuleHashes, .ModuleInfo.Attributes, .ModuleInfoExtender, .ModuleReferenceImpl, .ModuleResolution, .ModuleTarget, java.lang.classfile.attribute.ModulePackagesAttribute, java.lang.classfile.ClassBuilder, .ClassFile, .TypeKind, .CodeBuilder, java.nio.file.Files, .Path, jdk.tools.jlink.internal.ModuleSorter, jdk.tools.jlink.plugin.PluginException, .ResourcePool, .ResourcePoolBuilder, .ResourcePoolEntry

Jlink plugin to reconstitute module descriptors and other attributes for system modules. The plugin generates implementations of SystemModules to avoid parsing module-info.class files at startup. It also generates SystemModulesMap to return the SystemModules implementation for a specific initial module. As a side effect, the plugin adds the ModulePackages class file attribute to the module-info.class files that don't have the attribute.
See Also
jdk.internal.module.SystemModuleFinders, jdk.internal.module.SystemModules

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
pack-priv static class
SystemModulesPlugin.SystemModulesClassGenerator

Generates a SystemModules class to reconstitute the ModuleDescriptor and other attributes of system modules.

Field Summary

Modifier and TypeField and Description
private static final String
private static final ClassDesc
private static final ClassDesc
private static final ClassDesc
private static final int
private static final String
private boolean
private int
private static final MethodTypeDesc
private static final MethodTypeDesc
private static final String
private static final String
Inherited from jdk.tools.jlink.internal.plugins.AbstractPlugin:
DESCRIPTIONUSAGE

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
configure(Map<String, String> config)

Overrides default jdk.tools.jlink.plugin.Plugin.configure.

Configure the plugin based on the passed configuration.

private static ModuleFinder
finderOf(Collection<SystemModulesPlugin.ModuleInfo> moduleInfos)

Returns a module finder that finds all modules in the given list

private String

Returns:

the name of the class resource added to the pool
genSystemModulesClass
(List<SystemModulesPlugin.ModuleInfo> moduleInfos, Configuration cf, String className, ResourcePoolBuilder out)

Generate a SystemModules implementation class and add it as a resource.

private Set<String>

Returns:

the resource names of the resources added to the pool
genSystemModulesClasses
(List<SystemModulesPlugin.ModuleInfo> moduleInfos, ResourcePoolBuilder out)

Generates the SystemModules classes (at least one) and the SystemModulesMap class to map initial modules to a SystemModules class.

private String

Returns:

the name of the class resource added to the pool
genSystemModulesMapClass
(ClassDesc allSystemModules, ClassDesc defaultSystemModules, Map<String, String> map, ResourcePoolBuilder out)

Generate SystemModulesMap and add it as a resource.

public Set<Plugin.State>
getState()

Overrides default jdk.tools.jlink.plugin.Plugin.getState.

The Plugin set of states.

public boolean
hasArguments()

Overrides default jdk.tools.jlink.plugin.Plugin.hasArguments.

Has this plugin require one or more arguments?

private Configuration
resolve(ModuleFinder finder, Set<String> roots)

Resolves a collection of root modules, with service binding, to create a Configuration for the boot layer.

private static <T extends Comparable<T>> List<T>

Returns:

a sorted copy of the given collection.
sorted
(Collection<T> c)

Returns a sorted copy of a collection.

private List<SystemModulesPlugin.ModuleInfo>
sublist(List<SystemModulesPlugin.ModuleInfo> moduleInfos, Configuration cf)

Returns the list of ModuleInfo objects that correspond to the modules in the given configuration.

public ResourcePool
transform(ResourcePool in, ResourcePoolBuilder out)

Implements jdk.tools.jlink.plugin.Plugin.transform.

Visit the content of the modules that are composing the image.

pack-priv List<SystemModulesPlugin.ModuleInfo>

Returns:

the list of ModuleInfo objects, the first element is java.base
transformModuleInfos
(ResourcePool in, ResourcePoolBuilder out)

Validates and transforms the module-info.class files in the modules, adding the ModulePackages class file attribute if needed.

Inherited from jdk.tools.jlink.internal.plugins.AbstractPlugin:
getArgumentsDescriptiongetDescriptiongetMessagegetNamegetUsagenewClassReadernewClassReader