Class ModuleBinding
- All Implemented Interfaces:
IUpdatableModule
- Direct Known Subclasses:
BinaryModuleBinding,ModuleBinding.UnNamedModule,SourceModuleBinding
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.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.aspectj.org.eclipse.jdt.internal.compiler.env.IUpdatableModule
IUpdatableModule.AddExports, IUpdatableModule.AddReads, IUpdatableModule.UpdateKind, IUpdatableModule.UpdatesByKind -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final char[]Name to represent unnamed modules in --add-exports and --add-reads options.static final char[]Module name for package/type lookup that doesn't care about modules.static final char[]Module name for package/type lookup that should look into all named modules.Packages declared in this module (indexed by qualified name).intprotected PlainPackageBinding[]char[]intchar[]protected PlainPackageBinding[]protected ModuleBinding[]protected ModuleBinding[]protected TypeBinding[]longstatic final char[]Name of the unnamed module.static final char[]Module name for an unobservable moduleprotected TypeBinding[]Fields inherited from class org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Binding
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_COMPONENTS, 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_PERMITTEDTYPES, NO_PLAIN_PACKAGES, NO_REFERENCE_TYPES, NO_SUPERINTERFACES, NO_TYPE_VARIABLES, NO_TYPES, NULL_UNSPECIFIED_BY_DEFAULT, NullnessDefaultMASK, PACKAGE, PARAMETERIZED_TYPE, PATTERN, POLY_TYPE, RAW_TYPE, RECORD_COMPONENT, TYPE, TYPE_PARAMETER, TYPE_USE, UNINITIALIZED_COMPONENTS, UNINITIALIZED_FIELDS, UNINITIALIZED_METHODS, UNINITIALIZED_REFERENCE_TYPES, VARIABLE, WILDCARD_TYPE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedModuleBinding(char[] moduleName, LookupEnvironment existingEnvironment) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddExports(char[] packageName, char[][] targetModules) Perform an --add-exports update on the module.voidaddReads(char[] requiredModuleName) Perform an --add-reads update on the module.voidaddResolvedExport(PlainPackageBinding declaredPackage, char[][] targetModules) voidaddResolvedOpens(PlainPackageBinding declaredPackage, char[][] targetModules) booleancanAccess(PackageBinding pkg) Check if the given package is accessible by this module.char[]computeUniqueKey(boolean isLeaf) 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 dependenciesintString[]getImplementations(TypeBinding binding) String[]getOpens()getOrCreateDeclaredPackage(char[][] compoundName) char[][]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.getUses()getVisiblePackage(char[][] qualifiedPackageName) Answer the package of the given qualified name and visible in this module, ornullif no such package exists.booleanbooleanbooleanbooleanisOpen()booleanisPackageExportedTo(PackageBinding pkg, ModuleBinding client) Check if the specified package is owned by the current module and exported to the client module.booleanisTransitivelyRequired(ModuleBinding otherModule) booleanintkind()char[]name()Answer the name of this module.char[]Answer the name of this module as it should be used for hasCompilationUnit() checks.char[]Answer the name of this module as it should be used for package or type lookup.char[]protected voidrecordExportRestrictions(PlainPackageBinding exportedPackage, char[][] targetModules) protected voidrecordOpensRestrictions(PlainPackageBinding openedPackage, char[][] targetModules) retrieveAnnotationHolder(Binding binding, boolean forceInitialization) voidsetAnnotations(AnnotationBinding[] annotations, boolean forceStore) voidsetMainClassName(char[] mainClassName) Define the ModuleMainClass to be recorded in the generated module-info.class.voidsetPackageNames(SimpleSetOfCharArray packageNames) Passes names of packages to be recorded in the ModulePackages classfile attribute.toString()Methods inherited from class org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Binding
computeUniqueKey, getAnnotations, getAnnotationTagBits, initializeDeprecatedAnnotationTagBits, isAnnotationType, isParameter, isPatternVariable, isTaggedRepeatable, isValid, isValidBinding, isVolatile, problemId, setAnnotations, shortReadableName
-
Field Details
-
UNNAMED
public static final char[] UNNAMEDName of the unnamed module. -
ALL_UNNAMED
public static final char[] ALL_UNNAMEDName to represent unnamed modules in --add-exports and --add-reads options. -
ANY
public static final char[] ANYModule name for package/type lookup that doesn't care about modules. -
ANY_NAMED
public static final char[] ANY_NAMEDModule name for package/type lookup that should look into all named modules. -
UNOBSERVABLE
public static final char[] UNOBSERVABLEModule name for an unobservable module -
moduleName
public char[] moduleName -
requires
-
requiresTransitive
-
exportedPackages
-
openedPackages
-
uses
-
services
-
implementations
-
mainClassName
public char[] mainClassName -
modifiers
public int modifiers -
environment
-
tagBits
public long tagBits -
defaultNullness
public int defaultNullness -
declaredPackages
Packages declared in this module (indexed by qualified name). We consider a package as declared in a module, if a compilation unit associated with the module declares the package or a subpackage thereof.A package in this structures is always represented by a
PlainPackageBinding, as opposed toSplitPackageBinding, which are only maintained in the trees belowLookupEnvironment.knownPackages.This structure is populated early during compilation with all packages that are referenced in exports and opens directives, plus their parent packages.
-
-
Constructor Details
-
ModuleBinding
-
-
Method Details
-
getExports
-
getExportRestrictions
-
getOpens
-
getOpenRestrictions
-
getImplementations
-
getRequires
-
getRequiresTransitive
-
getUses
-
getServices
-
addReads
public void addReads(char[] requiredModuleName) Description copied from interface:IUpdatableModulePerform an --add-reads update on the module.- Specified by:
addReadsin interfaceIUpdatableModule
-
addExports
public void addExports(char[] packageName, char[][] targetModules) Description copied from interface:IUpdatableModulePerform an --add-exports update on the module.- Specified by:
addExportsin interfaceIUpdatableModule
-
setMainClassName
public void setMainClassName(char[] mainClassName) Description copied from interface:IUpdatableModuleDefine the ModuleMainClass to be recorded in the generated module-info.class.- Specified by:
setMainClassNamein interfaceIUpdatableModule
-
setPackageNames
Description copied from interface:IUpdatableModulePasses names of packages to be recorded in the ModulePackages classfile attribute.- Specified by:
setPackageNamesin interfaceIUpdatableModule
-
getPackageNamesForClassFile
public char[][] getPackageNamesForClassFile()- Returns:
- array of names, which may contain nulls.
-
getOrCreateDeclaredPackage
-
addResolvedExport
-
addResolvedOpens
-
recordExportRestrictions
protected void recordExportRestrictions(PlainPackageBinding exportedPackage, char[][] targetModules) -
recordOpensRestrictions
-
dependencyGraphCollector
-
dependencyCollector
-
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- Returns:
- An array of all required modules
-
name
public char[] name()Answer the name of this module. The unnamed module is identified byUNNAMED.- Specified by:
namein interfaceIUpdatableModule
-
nameForLookup
-
nameForCUCheck
public char[] nameForCUCheck()Answer the name of this module as it should be used for hasCompilationUnit() checks. -
isPackageExportedTo
Check if the specified package is owned by the current module and exported to the client module. True if the package appears in the list of exported packages and when the export is targeted, the module appears in the targets of the exports statement.- Parameters:
pkg- - the package whose visibility is to be checkedclient- - the module that wishes to use the package- Returns:
- true if the package is visible to the client module, false otherwise
-
getTopLevelPackage
Return a package binding if there exists a package named name in this module's context and it can be seen by this module. A package can be seen by this module if it is declared in this module or any other module read by this module (JLS 7.4.3 for packages based on JLS 7.3 for compilation units). Package exports are not considered for visibility check (only when checking "uniquely visible" (JLS 7.4.3)).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.
-
getVisiblePackage
Answer the package of the given qualified name and visible in this module, ornullif no such package exists. Accessibility (based on package exports) is not checked.May answer a
SplitPackageBinding. -
canAccess
Check if the given package is accessible by this module. True when the package is declared in this module or exported by some required module to this module. SeeisPackageExportedTo(PackageBinding, ModuleBinding)- Parameters:
pkg-- Returns:
- True, if the package is accessible by this module, false otherwise
-
computeUniqueKey
public char[] computeUniqueKey(boolean isLeaf) - Overrides:
computeUniqueKeyin classBinding
-
kind
-
readableName
public char[] readableName()- Specified by:
readableNamein classBinding
-
toString
-
isUnnamed
public boolean isUnnamed() -
isAutomatic
public boolean isAutomatic() -
isOpen
public boolean isOpen() -
isDeprecated
public boolean isDeprecated() -
hasUnstableAutoName
public boolean hasUnstableAutoName() -
isTransitivelyRequired
-
getDefaultNullness
public int getDefaultNullness() -
retrieveAnnotationHolder
-
setAnnotations
- Overrides:
setAnnotationsin classBinding
-