public class ModuleBinding extends Binding implements IUpdatableModule
First, it canonically represents modules in the world of bindings.
Secondly, it adds a graph layer on top of LookupEnvironment:
ModuleBindins are linked through "read" edges as per JPMS (see java.lang.module.Configuration).
Additionally, each ModuleBinding holds its own instance of LookupEnviroment,
capturing all packages and types that are visible to the current module.
As a subset of all visible types, the ModuleBinding knows the set of
packages locally declared in this module.
| Modifier and Type | Class and Description |
|---|---|
static class |
ModuleBinding.UnNamedModule |
IUpdatableModule.AddExports, IUpdatableModule.AddReads, IUpdatableModule.UpdateKind, IUpdatableModule.UpdatesByKind| Modifier and Type | Field and Description |
|---|---|
static char[] |
ALL_UNNAMED
Name to represent unnamed modules in --add-exports & --add-reads options.
|
static char[] |
ANY
Module name for package/type lookup that doesn't care about modules.
|
static char[] |
ANY_NAMED
Module name for package/type lookup that should look into all named modules.
|
HashtableOfPackage |
declaredPackages
Packages declared in this module (indexed by qualified name).
|
int |
defaultNullness |
LookupEnvironment |
environment |
protected PackageBinding[] |
exportedPackages |
java.util.Map<TypeBinding,TypeBinding[]> |
implementations |
char[] |
mainClassName |
int |
modifiers |
char[] |
moduleName |
protected PackageBinding[] |
openedPackages |
protected ModuleBinding[] |
requires |
protected ModuleBinding[] |
requiresTransitive |
protected TypeBinding[] |
services |
long |
tagBits |
static char[] |
UNNAMED
Name of the unnamed module.
|
protected TypeBinding[] |
uses |
ANY_EXCEPTION, ARRAY_TYPE, BASE_TYPE, DefaultLocationArrayContents, DefaultLocationField, DefaultLocationParameter, DefaultLocationReturnType, DefaultLocationsForTrueValue, DefaultLocationTypeArgument, DefaultLocationTypeBound, DefaultLocationTypeParameter, FIELD, GENERIC_TYPE, IMPORT, INTERSECTION_TYPE, INTERSECTION_TYPE18, LOCAL, METHOD, MODULE, NO_ANNOTATIONS, NO_ELEMENT_VALUE_PAIRS, NO_EXCEPTIONS, NO_FIELDS, NO_MEMBER_TYPES, NO_METHODS, NO_MODULES, NO_NULL_DEFAULT, NO_PACKAGES, NO_PARAMETER_NAMES, NO_PARAMETERS, NO_REFERENCE_TYPES, NO_SUPERINTERFACES, NO_TYPE_VARIABLES, NO_TYPES, NULL_UNSPECIFIED_BY_DEFAULT, NullnessDefaultMASK, PACKAGE, PARAMETERIZED_TYPE, POLY_TYPE, RAW_TYPE, TYPE, TYPE_PARAMETER, TYPE_USE, UNINITIALIZED_FIELDS, UNINITIALIZED_METHODS, UNINITIALIZED_REFERENCE_TYPES, VARIABLE, WILDCARD_TYPE| Modifier | Constructor and Description |
|---|---|
protected |
ModuleBinding(char[] moduleName,
LookupEnvironment existingEnvironment) |
| Modifier and Type | Method and Description |
|---|---|
void |
addExports(char[] packageName,
char[][] targetModules)
Perform an --add-exports update on the module.
|
void |
addReads(char[] requiredModuleName)
Perform an --add-reads update on the module.
|
void |
addResolvedExport(PackageBinding declaredPackage,
char[][] targetModules) |
void |
addResolvedOpens(PackageBinding declaredPackage,
char[][] targetModules) |
boolean |
canAccess(PackageBinding pkg)
Check if the given package is accessible by this module.
|
char[] |
computeUniqueKey(boolean isLeaf) |
java.util.function.Supplier<java.util.Collection<ModuleBinding>> |
dependencyCollector() |
java.util.function.Supplier<java.util.Collection<ModuleBinding>> |
dependencyGraphCollector() |
ModuleBinding[] |
getAllRequiredModules()
Get all the modules required by this module
All required modules include modules explicitly specified as required in the module declaration
as well as implicit dependencies - those specified as ' requires transitive ' by one of the
dependencies
|
int |
getDefaultNullness() |
java.lang.String[] |
getExportRestrictions(PackageBinding pack) |
PackageBinding[] |
getExports() |
TypeBinding[] |
getImplementations(TypeBinding binding) |
java.lang.String[] |
getOpenRestrictions(PackageBinding pack) |
PackageBinding[] |
getOpens() |
PackageBinding |
getPackage(char[][] parentPackageName,
char[] packageName)
Answer a package, that is a member named packageName of the parent package
named parentPackageName.
|
char[][] |
getPackageNamesForClassFile() |
ModuleBinding[] |
getRequires() |
ModuleBinding[] |
getRequiresTransitive() |
TypeBinding[] |
getServices() |
PackageBinding |
getTopLevelPackage(char[] name)
Return a package binding if there exists a package named name in this module's context and it can be seen by this module.
|
TypeBinding[] |
getUses() |
PackageBinding |
getVisiblePackage(char[][] qualifiedPackageName)
Answer the package of the given qualified name and visible in this module,
or
null if no such package exists. |
boolean |
hasUnstableAutoName() |
boolean |
isDeprecated() |
boolean |
isOpen() |
boolean |
isPackageExportedTo(PackageBinding pkg,
ModuleBinding client)
Check if the specified package is owned by the current module and exported to the client module.
|
boolean |
isTransitivelyRequired(ModuleBinding otherModule) |
boolean |
isUnnamed() |
int |
kind() |
char[] |
name()
Answer the name of this module.
|
char[] |
nameForLookup()
Answer the name of this module as it should be used for package or type lookup.
|
char[] |
readableName() |
protected void |
recordExportRestrictions(PackageBinding exportedPackage,
char[][] targetModules) |
protected void |
recordOpensRestrictions(PackageBinding openedPackage,
char[][] targetModules) |
AnnotationHolder |
retrieveAnnotationHolder(Binding binding,
boolean forceInitialization) |
void |
setAnnotations(AnnotationBinding[] annotations,
boolean forceStore) |
void |
setMainClassName(char[] mainClassName)
Define the ModuleMainClass to be recorded in the generated module-info.class.
|
void |
setPackageNames(SimpleSetOfCharArray packageNames)
Passes names of packages to be recorded in the ModulePackages classfile attribute.
|
java.lang.String |
toString() |
computeUniqueKey, getAnnotations, getAnnotationTagBits, initializeDeprecatedAnnotationTagBits, isAnnotationType, isParameter, isTaggedRepeatable, isValid, isValidBinding, isVolatile, problemId, setAnnotations, shortReadableNamepublic static final char[] UNNAMED
public static final char[] ALL_UNNAMED
public static final char[] ANY
public static final char[] ANY_NAMED
public char[] moduleName
protected ModuleBinding[] requires
protected ModuleBinding[] requiresTransitive
protected PackageBinding[] exportedPackages
protected PackageBinding[] openedPackages
protected TypeBinding[] uses
protected TypeBinding[] services
public java.util.Map<TypeBinding,TypeBinding[]> implementations
public char[] mainClassName
public int modifiers
public LookupEnvironment environment
public long tagBits
public int defaultNullness
public HashtableOfPackage declaredPackages
protected ModuleBinding(char[] moduleName,
LookupEnvironment existingEnvironment)
public PackageBinding[] getExports()
public java.lang.String[] getExportRestrictions(PackageBinding pack)
public PackageBinding[] getOpens()
public java.lang.String[] getOpenRestrictions(PackageBinding pack)
public TypeBinding[] getImplementations(TypeBinding binding)
public ModuleBinding[] getRequires()
public ModuleBinding[] getRequiresTransitive()
public TypeBinding[] getUses()
public TypeBinding[] getServices()
public void addReads(char[] requiredModuleName)
IUpdatableModuleaddReads in interface IUpdatableModulepublic void addExports(char[] packageName,
char[][] targetModules)
IUpdatableModuleaddExports in interface IUpdatableModulepublic void setMainClassName(char[] mainClassName)
IUpdatableModulesetMainClassName in interface IUpdatableModulepublic void setPackageNames(SimpleSetOfCharArray packageNames)
IUpdatableModulesetPackageNames in interface IUpdatableModulepublic char[][] getPackageNamesForClassFile()
public void addResolvedExport(PackageBinding declaredPackage, char[][] targetModules)
public void addResolvedOpens(PackageBinding declaredPackage, char[][] targetModules)
protected void recordExportRestrictions(PackageBinding exportedPackage, char[][] targetModules)
protected void recordOpensRestrictions(PackageBinding openedPackage, char[][] targetModules)
public java.util.function.Supplier<java.util.Collection<ModuleBinding>> dependencyGraphCollector()
public java.util.function.Supplier<java.util.Collection<ModuleBinding>> dependencyCollector()
public ModuleBinding[] getAllRequiredModules()
public char[] name()
UNNAMED.name in interface IUpdatableModulepublic char[] nameForLookup()
public boolean isPackageExportedTo(PackageBinding pkg, ModuleBinding client)
pkg - - the package whose visibility is to be checkedclient - - the module that wishes to use the packagepublic PackageBinding getTopLevelPackage(char[] name)
The returned package may be a SplitPackageBinding, if more than one package of the given name is visible.
When asked via the unnamed module or an automatic module all other named modules are considered visible.
public PackageBinding getVisiblePackage(char[][] qualifiedPackageName)
null if no such package exists.
Accessibility (based on package exports) is not checked.
May answer a SplitPackageBinding.
public PackageBinding getPackage(char[][] parentPackageName, char[] packageName)
public boolean canAccess(PackageBinding pkg)
isPackageExportedTo(PackageBinding, ModuleBinding)pkg - public char[] computeUniqueKey(boolean isLeaf)
computeUniqueKey in class Bindingpublic char[] readableName()
readableName in class Bindingpublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean isUnnamed()
public boolean isOpen()
public boolean isDeprecated()
public boolean hasUnstableAutoName()
public boolean isTransitivelyRequired(ModuleBinding otherModule)
public int getDefaultNullness()
public AnnotationHolder retrieveAnnotationHolder(Binding binding, boolean forceInitialization)
public void setAnnotations(AnnotationBinding[] annotations, boolean forceStore)
setAnnotations in class Binding