Class ClassScope
java.lang.Object
org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope
org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ClassScope
- Direct Known Subclasses:
InterTypeScope
-
Nested Class Summary
Nested classes/interfaces inherited from class Scope
Scope.Substitutor -
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanThis is the primary flag for detection of early construction contexts (JEP 513).booleanFields inherited from class Scope
AUTOBOX_COMPATIBLE, BLOCK_SCOPE, CLASS_SCOPE, COMPATIBLE, COMPATIBLE_IGNORING_MISSING_TYPE, COMPILATION_UNIT_SCOPE, compilationUnitScope, EQUAL_OR_MORE_SPECIFIC, kind, METHOD_SCOPE, MODULE_SCOPE, MORE_GENERIC, NOT_COMPATIBLE, NOT_REDUNDANT, NOT_RELATED, parent, VARARGS_COMPATIBLEModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intintstatic final intstatic final intstatic final intstatic final intstatic Bindingstatic final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintaddDepth()voidbuildAnonymousTypeBinding(SourceTypeBinding enclosingType, ReferenceBinding supertype) voidvoidcheckRedundantDefaultNullness(int nullBits, int sourceStart) Check whether the given null default is redundant at the given position inside this scope.booleandetectHierarchyCycle(TypeBinding superType, TypeReference reference) final MethodBindingbooleanhasDefaultNullnessFor(int location, int sourceStart) Answer a defaultNullness defined for the closest enclosing scope, using bits from Binding.NullnessDefaultMASK.For Java scopes, the invocationType is always the same as the enclosingSourceType This distinction is important for AspectJ's inter-type declarations For inter-type declarations, the invocationType is the lexically enclosing type.See also the contract ofProblemReporter.close().toString()Methods inherited from class Scope
boxing, classScope, collectClassesBeingInitialized, compareTypes, compilationUnitScope, compilerOptions, computeCompatibleMethod, connectTypeVariables, convertEliminatingTypeVariables, createArrayType, createArrayType, createTypeVariables, deferBoundCheck, enclosingClassScope, enclosingInstanceScope, enclosingLambdaScope, enclosingMethodScope, enclosingReceiverType, enclosingReferenceContext, enclosingSourceType, enclosingSwitchLabel, enterEarlyConstructionContext, environment, exclude, findDefaultAbstractMethod, findDirectMemberType, findExactMethod, findField, findField, findMemberType, findMethod, findMethod0, findMethodForArray, findMethodInSuperInterfaces, findPrivilegedHandler, findType, findTypeVariable, findVariable, getBaseType, getBinding, getCommonReferenceBinding, getConstructor, getConstructor0, getCurrentPackage, getDeclarationModifiers, getExactConstructor, getExactMethod, getField, getImplicitMethod, getJavaIoSerializable, getJavaLangAnnotationAnnotation, getJavaLangAssertionError, getJavaLangBoolean, getJavaLangByte, getJavaLangCharacter, getJavaLangClass, getJavaLangClassDesc, getJavaLangClassNotFoundException, getJavaLangCloneable, getJavaLangDouble, getJavaLangEnum, getJavaLangEnumDesc, getJavaLangError, getJavaLangFloat, getJavaLangIllegalArgumentException, getJavaLangIncompatibleClassChangeError, getJavaLangInteger, getJavaLangInvokeConstantBootstraps, getJavaLangInvokeLambdaMetafactory, getJavaLangInvokeMethodHandle, getJavaLangInvokeMethodHandlesLookup, getJavaLangInvokeSerializedLambda, getJavaLangInvokeStringConcatFactory, getJavaLangInvokeVarHandle, getJavaLangIterable, getJavaLangLong, getJavaLangNoClassDefFoundError, getJavaLangNoSuchFieldError, getJavaLangObject, getJavaLangRecord, getJavaLangReflectField, getJavaLangReflectMethod, getJavaLangRuntimeObjectMethods, getJavaLangRuntimeSwitchBootstraps, getJavaLangShort, getJavaLangString, getJavaLangStringBuffer, getJavaLangStringBuilder, getJavaLangThrowable, getJavaLangVoid, getJavaUtilIterator, getMatchingUninitializedType, getMemberType, getMethod, getOnlyPackage, getPackage, getStaticFactory, getType, getType, getType, getTypeOrPackage, greaterLowerBound, greaterLowerBound, hasDefaultNullnessForType, hasErasedCandidatesCollisions, include, isBoxingCompatibleWith, isDefinedInField, isDefinedInMethod, isDefinedInSameEnclosingType, isDefinedInSameUnit, isDefinedInType, isInsideCase, isInsideDeprecatedCode, isInsideEarlyConstructionContext, isInStaticContext, isInterTypeScope, isLambdaScope, isLambdaSubscope, isSubtypeOfRawType, leaveEarlyConstructionContext, localCheckRedundantDefaultNullness, localNonNullByDefaultValue, lowerUpperBound, methodScope, minimalErasedCandidates, module, mostSpecificClassMethodBinding, mostSpecificInterfaceMethodBinding, mostSpecificMethodBinding, namedMethodScope, nearestEnclosingStaticScope, originalReferenceContext, outerMostClassScope, outerMostMethodScope, parameterCompatibilityLevel, parameterCompatibilityLevel, parameterCompatibilityLevelFromInference, recordNonNullByDefault, referenceCompilationUnit, referenceContext, resolvingGuardExpression, setParent, substitute, substitute, substitute, tagAsAccessingEnclosingInstanceStateOf, typeAnnotationsResolutionScope, validateNullAnnotationModifier and TypeMethodDescriptionboxing(TypeBinding type) final ClassScopeThis method captures the status of early construction context at the declaration of a lambda expression.static intcompareTypes(TypeBinding left, TypeBinding right) final CompilationUnitScopefinal CompilerOptionsFinds the most specific compiler optionsprotected final MethodBindingcomputeCompatibleMethod(MethodBinding method, TypeBinding[] arguments, InvocationSite invocationSite) Internal use only Given a method, returns null if arguments cannot be converted to parameters.protected booleanconnectTypeVariables(TypeParameter[] typeParameters, boolean checkForErasedCandidateCollisions) Connect type variable supertypes, and returns true if no problem was detectedstatic TypeBindingconvertEliminatingTypeVariables(TypeBinding originalType, ReferenceBinding genericType, int rank, Set<TypeBinding> eliminatedVariables) Returns a type where either all variables or specific ones got discarded.createArrayType(TypeBinding type, int dimension) createArrayType(TypeBinding type, int dimension, AnnotationBinding[] annotations) createTypeVariables(TypeParameter[] typeParameters, Binding declaringElement) voiddeferBoundCheck(TypeReference typeRef) final ClassScopefinal MethodScopefinal MethodScopefinal ReferenceBindingReturns the immediately enclosing reference context, starting from current scope parent.final SourceTypeBindingReturns the immediately enclosing case statement (carried by closest blockScope),voidCalled when a ctor with a late explicit constructor call starts processing statements.final LookupEnvironmentvoidexclude(LocalVariableBinding[] bindings) protected MethodBindingfindDefaultAbstractMethod(ReferenceBinding receiverType, char[] selector, TypeBinding[] argumentTypes, InvocationSite invocationSite, ReferenceBinding classHierarchyStart, ObjectVector found, MethodBinding[] concreteMatches) findDirectMemberType(char[] typeName, ReferenceBinding enclosingType) findExactMethod(ReferenceBinding receiverType, char[] selector, TypeBinding[] argumentTypes, InvocationSite invocationSite) findField(TypeBinding receiverType, char[] fieldName, InvocationSite invocationSite, boolean needResolve) findField(TypeBinding receiverType, char[] fieldName, InvocationSite invocationSite, boolean needResolve, boolean invisibleFieldsOk) findMemberType(char[] typeName, ReferenceBinding enclosingType) findMethod(ReferenceBinding receiverType, char[] selector, TypeBinding[] argumentTypes, InvocationSite invocationSite, boolean inStaticContext) findMethod0(ReferenceBinding receiverType, char[] selector, TypeBinding[] argumentTypes, InvocationSite invocationSite, boolean inStaticContext) findMethodForArray(ArrayBinding receiverType, char[] selector, TypeBinding[] argumentTypes, InvocationSite invocationSite) protected voidfindMethodInSuperInterfaces(ReferenceBinding receiverType, char[] selector, ObjectVector found, List<TypeBinding> visitedTypes, InvocationSite invocationSite) static final IPrivilegedHandlerfindType(char[] typeName, PackageBinding declarationPackage, PackageBinding invocationPackage) findTypeVariable(char[] name, SourceTypeBinding sourceType) Other scopes can override this methodfindVariable(char[] variable) static TypeBindinggetBaseType(char[] name) getBinding(char[] name, int mask, InvocationSite invocationSite, boolean needResolve) getCommonReferenceBinding(char[] typeName) getConstructor(ReferenceBinding receiverType, TypeBinding[] argumentTypes, InvocationSite invocationSite) getConstructor0(ReferenceBinding receiverType, TypeBinding[] argumentTypes, InvocationSite invocationSite) final PackageBindingintReturns the modifiers of the innermost enclosing declaration.getExactConstructor(TypeBinding receiverType, InvocationSite invocationSite) getExactMethod(TypeBinding receiverType, char[] selector, InvocationSite invocationSite) getField(TypeBinding receiverType, char[] fieldName, InvocationSite invocationSite) getImplicitMethod(char[] selector, TypeBinding[] argumentTypes, InvocationSite invocationSite) final ReferenceBindingfinal ReferenceBindingfinal ReferenceBindingfinal ReferenceBindingfinal ReferenceBindingfinal ReferenceBindingfinal ReferenceBindingfinal ReferenceBindingfinal ReferenceBindingfinal ReferenceBindingfinal ReferenceBindingfinal ReferenceBindingfinal ReferenceBindingfinal ReferenceBindingfinal ReferenceBindingfinal ReferenceBindingfinal ReferenceBindingfinal ReferenceBindingfinal ReferenceBindingfinal ReferenceBindingfinal ReferenceBindingfinal ReferenceBindingfinal ReferenceBindingfinal ReferenceBindingfinal ReferenceBindingfinal ReferenceBindingfinal ReferenceBindingfinal ReferenceBindingfinal ReferenceBindingfinal ReferenceBindingfinal ReferenceBindingfinal ReferenceBindingfinal ReferenceBindingfinal ReferenceBindingfinal ReferenceBindingfinal ReferenceBindingfinal ReferenceBindingfinal ReferenceBindingfinal ReferenceBindingfinal ReferenceBindingfinal ReferenceBindingfinal ReferenceBindinggetMatchingUninitializedType(TypeBinding targetClass, boolean considerEnclosings) final ReferenceBindinggetMemberType(char[] typeName, ReferenceBinding enclosingType) getMethod(TypeBinding receiverType, char[] selector, TypeBinding[] argumentTypes, InvocationSite invocationSite) final BindinggetOnlyPackage(char[][] compoundName) final BindinggetPackage(char[][] compoundName) getStaticFactory(ParameterizedTypeBinding allocationType, ReferenceBinding originalEnclosingType, TypeBinding[] argumentTypes, InvocationSite allocationSite) final TypeBindinggetType(char[] name) final TypeBindinggetType(char[][] compoundName, int typeNameLength) final TypeBindinggetType(char[] name, PackageBinding packageBinding) final BindinggetTypeOrPackage(char[][] compoundName) static ReferenceBinding[]greaterLowerBound(ReferenceBinding[] types) static TypeBinding[]greaterLowerBound(TypeBinding[] types, Scope scope, LookupEnvironment environment) booleanhasDefaultNullnessForType(TypeBinding type, int location, int sourceStart) booleanhasErasedCandidatesCollisions(TypeBinding one, TypeBinding two, Map<TypeBinding, Object> invocations, ReferenceBinding type, ASTNode typeRef) voidinclude(LocalVariableBinding[] bindings) booleanisBoxingCompatibleWith(TypeBinding expressionType, TypeBinding targetType) final booleanisDefinedInField(FieldBinding field) final booleanisDefinedInMethod(MethodBinding method) final booleanfinal booleanfinal booleanbooleanisInsideCase(CaseStatement caseStatement) Returns true if the scope or one of its parent is associated to a given caseStatement, denoting being part of a given switch case statement.booleanbooleanisInsideEarlyConstructionContext(TypeBinding targetClass, boolean considerEnclosings) Is an instance of targetClass currently being constructed in this scope?booleanbooleanbooleanbooleanbooleanisSubtypeOfRawType(TypeBinding paramType) voidCalled at the end of processing a late explicit constructor call.protected final BindinglocalCheckRedundantDefaultNullness(int nullBits, int position) final intlocalNonNullByDefaultValue(int start) lowerUpperBound(TypeBinding[] types) Returns VoidBinding if types have no intersection (e.g.final MethodScopeprotected TypeBinding[]minimalErasedCandidates(TypeBinding[] types, Map<TypeBinding, Object> allInvocations) Returns the most specific set of types compatible with all given types.module()protected final MethodBindingmostSpecificClassMethodBinding(MethodBinding[] visible, int visibleSize, InvocationSite invocationSite) protected final MethodBindingmostSpecificInterfaceMethodBinding(MethodBinding[] visible, int visibleSize, InvocationSite invocationSite) protected final MethodBindingmostSpecificMethodBinding(MethodBinding[] visible, int visibleSize, TypeBinding[] argumentTypes, InvocationSite invocationSite, ReferenceBinding receiverType) final MethodScopefinal MethodScopeReturns the nearest original reference context, starting from current scope.final ClassScopefinal MethodScopeintparameterCompatibilityLevel(MethodBinding method, TypeBinding[] arguments, InvocationSite site) intparameterCompatibilityLevel(TypeBinding arg, TypeBinding param) intparameterCompatibilityLevelFromInference(MethodBinding method, TypeBinding[] arguments, InvocationSite site) booleanrecordNonNullByDefault(Binding target, int value, Annotation annotation, int scopeStart, int scopeEnd) Record a NNBD annotation applying to a given source range within the current scopeReturns the nearest reference context, starting from current scope.booleanvoidstatic ReferenceBinding[]substitute(Substitution substitution, ReferenceBinding[] originalTypes) Returns an array of types, where original types got substituted given a substitution.static TypeBindingsubstitute(Substitution substitution, TypeBinding originalType) Returns a type, where original type was substituted using the receiver parameterized type.static TypeBinding[]substitute(Substitution substitution, TypeBinding[] originalTypes) Returns an array of types, where original types got substituted given a substitution.voidtagAsAccessingEnclosingInstanceStateOf(ReferenceBinding enclosingType, boolean typeVariableAccess) static BlockScopebooleanvalidateNullAnnotation(long tagBits, TypeReference typeRef, Annotation[] annotations)
-
Field Details
-
referenceContext
-
superTypeReference
-
resolvingPolyExpressionArguments
public boolean resolvingPolyExpressionArguments -
insideEarlyConstructionContext
public boolean insideEarlyConstructionContextThis is the primary flag for detection of early construction contexts (JEP 513). It is temporarily set on the scope of a class while processing statements of this class's early construction context (during resolveType(), analyseCode() and generateCode())Main access is via
Scope.enterEarlyConstructionContext(),Scope.leaveEarlyConstructionContext()andScope.isInsideEarlyConstructionContext(TypeBinding, boolean).For the case of
LambdaExpressionthis information is captured during resolve intoscopesInEarlyConstruction, for use during generateCode(), which doesn't have the context of the lambda declaration.All this is always active at compliance 23+, see
JavaFeature.FLEXIBLE_CONSTRUCTOR_BODIESfor details on where enablement is actually checked.
-
-
Constructor Details
-
ClassScope
-
-
Method Details
-
buildAnonymousTypeBinding
-
checkParameterizedSuperTypeCollisions
public void checkParameterizedSuperTypeCollisions() -
checkParameterizedTypeBounds
public void checkParameterizedTypeBounds() -
detectHierarchyCycle
-
problemReporter
Description copied from class:ScopeSee also the contract ofProblemReporter.close().- Specified by:
problemReporterin classScope
-
referenceType
-
enclosingMethod
-
hasDefaultNullnessFor
public boolean hasDefaultNullnessFor(int location, int sourceStart) Description copied from class:ScopeAnswer a defaultNullness defined for the closest enclosing scope, using bits from Binding.NullnessDefaultMASK.- Overrides:
hasDefaultNullnessForin classScope
-
checkRedundantDefaultNullness
Description copied from class:ScopeCheck whether the given null default is redundant at the given position inside this scope.- Overrides:
checkRedundantDefaultNullnessin classScope- Parameters:
nullBits- locally defined nullness default, see Binding.NullnessDefaultMASK- Returns:
- enclosing binding that already has a matching NonNullByDefault annotation,
or the special binding
Scope.NOT_REDUNDANT, indicating that a different enclosing nullness default was found, or null to indicate that no enclosing nullness default was found.
-
toString
-
addDepth
public int addDepth() -
invocationType
Description copied from class:ScopeFor Java scopes, the invocationType is always the same as the enclosingSourceType This distinction is important for AspectJ's inter-type declarations For inter-type declarations, the invocationType is the lexically enclosing type.- Overrides:
invocationTypein classScope
-