Class ReferenceBinding
java.lang.Object
org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Binding
org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding
org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding
-
Field Summary
FieldsModifier and TypeFieldDescriptionchar[][]static final ReferenceBindingintprotected static ProblemMethodBindingprotected MethodBinding[]char[]Fields inherited from class org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding
BOOLEAN, BYTE, CHAR, DOUBLE, extendedTagBits, FLOAT, id, INT, LONG, NULL, SHORT, tagBits, TYPE_USE_BINDING, typeAnnotations, VOIDFields 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanUsed to implement this sentence from o.e.j.annotation.DefaultLocation: "Wildcards and the use of type variables are always excluded from NonNullByDefault."protected voidappendNullAnnotation(StringBuilder nameBuffer, CompilerOptions options) protected intprotected intReturn the array of resolvable fields (resilience)Return the array of resolvable methods (resilience)static FieldBindingbinarySearch(char[] name, FieldBinding[] sortedFields) static longbinarySearch(char[] selector, MethodBinding[] sortedMethods) Returns a combined range value representing:(start + (end<<32)), where start is the index of the first matching method (remember methods are sorted alphabetically on selectors), and end is the index of last contiguous methods with same selector.booleanAnswer true if the receiver can be instantiatedbooleancanBeSeenBy(PackageBinding invocationPackage) Answer true if the receiver is visible to the invocationPackage.booleancanBeSeenBy(ReferenceBinding receiverType, ReferenceBinding invocationType) Answer true if the receiver is visible to the receiverType and the invocationType.booleancanBeSeenBy(Scope scope) Answer true if the receiver is visible to the type provided by the scope.char[]computeGenericTypeSignature(TypeVariableBinding[] typeVariables) voidvoidcomputeId(LookupEnvironment environment) char[]computeUniqueKey(boolean isLeaf) p.X<T extends Y & I, U extends Y> -> Lp/X<TT;TU;>;char[]Answer the receiver's constant pool name.intdepth()booleanvoiddownwardsProjection(Scope scope, TypeBinding[] mentionedTypeVariables) Perform a downwards type projection as per JLS 4.10.5final ReferenceBindingenclosingTypeAt(int relativeDepth) intintfields()final intlongCompute the tagbits for standard annotations.getComponent(char[] componentName, boolean needResolve) intgetExactConstructor(TypeBinding[] argumentTypes) getExactMethod(char[] selector, TypeBinding[] argumentTypes, CompilationUnitScope refScope) getField(char[] fieldName, boolean needResolve) getField(char[] fieldName, boolean resolve, InvocationSite site, Scope scope) Where multiple fields with the same name are defined, this will return the one most visible one...char[]protected MethodBinding[]getInterfaceAbstractContracts(Scope scope, boolean replaceWildcards, boolean filterDefaultMethods) getMemberType(char[] typeName) Find the member type with the given simple typeName.getMethods(char[] selector) getMethods(char[] selector, int suggestedParameterLength) intgetRecordComponent(char[] name) getRecordComponentAccessor(char[] name) Get the accessor method given the record component namegetSingleAbstractMethod(Scope scope, boolean replaceWildcards) Return the single abstract method of a functional interface, or one ofnullorsamProblemBinding, if the receiver is not a functional interface as defined in JLS 9.8.getTypeVariable(char[] variableName) booleaninthashCode()booleanbooleanhasIncompatibleSuperType(ReferenceBinding otherType) Returns true if the two types have an incompatible common supertype, e.g.booleanprotected booleanhasMethodWithNumArgs(char[] selector, int numArgs) booleanhasNullBit(int mask) Query typeBits without triggering supertype lookup.final booleanbooleanimplementsInterface(ReferenceBinding anInterface, boolean searchHierarchy) Answer true if the receiver implements anInterface or is identical to anInterface.final booleaninnerCanBeSeenBy(ReferenceBinding receiverType, ReferenceBinding invocationType) final booleaninnerCanBeSeenBy(Scope scope) final booleanAnswer true if the receiver is an abstract typebooleanfinal booleanbooleanisClass()booleanisCompatibleWith(TypeBinding otherType, Scope captureScope) Answer true if the receiver type can be assigned to the argument type (right) In addition to improving performance, caching also ensures there is no infinite regression since per nature, the compatibility check is recursive through parameterized type arguments (122775)static booleanisConsistentIntersection(TypeBinding[] intersectingTypes) final booleanAnswer true if the receiver has default visibilityfinal booleanAnswer true if the receiver is a deprecated typebooleanisEnum()protected booleanfinal booleanisFinal()Answer true if the receiver is final and cannot be subclassedbooleanisFunctionalInterface(Scope scope) booleanReturns true if the type hierarchy is being connected "actively" i.e not paused momentatrily, while resolving type arguments.booleanReturns true if the type hierarchy is being connectedbooleanReturns true if the type hierarchy is connectedbooleanfinal booleanAnswer true if the receiver definition is in preconstructor context - true only in such cases for anonymous type - Java 22 - preview - JEP 447booleanbooleanisNestmateOf(ReferenceBinding other) final booleanAnswer true if the receiver has non-sealed modifierfinal booleanAnswer true if the receiver or any of its enclosing types have private visibilityfinal booleanAnswer true if the receiver has private visibilitybooleanisProperType(boolean admitCapture18) JLS8 Sect 18.1.1final booleanAnswer true if the receiver has protected visibilityfinal booleanisPublic()Answer true if the receiver has public visibilitybooleanisSealed()Answer true if the receiver has sealed modifierfinal booleanisStatic()Answer true if the receiver is a static member type (or toplevel)final booleanAnswer true if all float operations must adher to IEEE 754 float/double rulesbooleanisSubtypeOf(TypeBinding other, boolean simulatingBugJDK8026527) protected booleanisSubTypeOfRTL(TypeBinding other) booleanisSuperclassOf(ReferenceBinding otherType) Answer true if the receiver is in the superclass hierarchy of aType NOTE: Object.isSuperclassOf(Object) -> falsebooleanReturns true if a given type may be thrownbooleanisUncheckedException(boolean includeSupertype) JLS 11.5 ensures that Throwable, Exception, RuntimeException and Error are directly connected.final booleanisUsed()Answer true if the receiver has private visibility and is used locallyfinal booleanAnswer true if the receiver is deprecated (or any of its enclosing types)Returns the member types of this type sorted by simple name.methods()module()char[]nullAnnotatedReadableName(CompilerOptions options, boolean shortNames) Answer a readable name (for error reporting) that includes nullness type annotations.final ReferenceBindingchar[]Answer the source name for the type.char[]Answer the receiver's signature.char[]readableName(boolean showGenerics) retrieveAnnotationHolder(Binding binding, boolean forceInitialization) voidsetAnnotations(AnnotationBinding[] annotations, boolean forceStore) voidvoidchar[]char[]shortReadableName(boolean showGenerics) char[]Answer the receiver classfile signature.static voidsortFields(FieldBinding[] sortedFields, int left, int right) Sort the field array using a quicksortstatic voidsortMethods(MethodBinding[] sortedMethods, int left, int right) Sort the field array using a quicksortchar[]voidupwardsProjection(Scope scope, TypeBinding[] mentionedTypeVariables) Perform an upwards type projection as per JLS 4.10.5Methods inherited from class org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding
actualType, annotatedDebugName, capture, clone, closestMatch, collectMissingTypes, collectSubstitutes, components, containerAnnotationType, dimensions, enclosingMethod, enclosingType, enterRecursiveFunction, equalsEquals, erasure, exitRecursiveFunction, findSuperTypeOriginatingFrom, findSuperTypeOriginatingFrom, genericCast, genericTypeSignature, getErasureCompatibleType, getIntersectingTypes, getTypeAnnotations, hasNullTypeAnnotations, hasTypeAnnotations, hasTypeBit, hasValueBasedTypeAnnotation, isAnonymousType, isArrayType, isBaseType, isBoundParameterizedType, isBoxedPrimitiveType, isBoxingCompatibleWith, isCapture, isCompatibleWith, isEquivalentTo, isFreeTypeVariable, isFunctionalType, isGenericType, isHierarchyInconsistent, isIntersectionType, isIntersectionType18, isLocalType, isMemberType, isNestedType, isNonDenotable, isNumericType, isParameterizedType, isParameterizedTypeWithActualArguments, isParameterizedWithOwnVariables, isPolyType, isPotentiallyCompatibleWith, isPrimitiveOrBoxedPrimitiveType, isPrimitiveType, isProvablyDistinct, isRawType, isReadyForAnnotations, isRecord, isReifiable, isRepeatableAnnotationType, isTypeArgumentContainedBy, isTypeVariable, isUnboundWildcard, isUnresolvedType, isWildcard, kind, leafComponentType, mentionsAny, needsUncheckedConversion, notEquals, original, prototype, qualifiedPackageName, setTypeAnnotations, signableName, sIsMoreSpecific, swapUnresolved, syntheticOuterLocalVariables, syntheticTypeVariablesMentioned, typeVariables, unannotated, uncapture, updateTagBits, wellKnownBaseType, wellKnownType, withoutToplevelNullAnnotationMethods inherited from class org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Binding
computeUniqueKey, initializeDeprecatedAnnotationTagBits, isParameter, isPatternVariable, isTaggedRepeatable, isValid, isValidBinding, isVolatile, problemId, setAnnotations
-
Field Details
-
compoundName
public char[][] compoundName -
sourceName
public char[] sourceName -
modifiers
public int modifiers -
fPackage
-
singleAbstractMethod
-
LUB_GENERIC
-
samProblemBinding
-
-
Constructor Details
-
ReferenceBinding
-
ReferenceBinding
public ReferenceBinding()
-
-
Method Details
-
getRecordComponentAccessor
Get the accessor method given the record component name- Parameters:
name- name of the record component- Returns:
- the method binding of the accessor if found, else null
-
binarySearch
-
binarySearch
Returns a combined range value representing:(start + (end<<32)), where start is the index of the first matching method (remember methods are sorted alphabetically on selectors), and end is the index of last contiguous methods with same selector. -1 means no method got found- Returns:
(start + (end<<32))or -1 if no method found
-
sortFields
Sort the field array using a quicksort -
sortMethods
Sort the field array using a quicksort -
availableFields
Return the array of resolvable fields (resilience) -
availableMethods
Return the array of resolvable methods (resilience) -
hasHierarchyCheckStarted
public boolean hasHierarchyCheckStarted() -
setHierarchyCheckDone
public void setHierarchyCheckDone() -
isFieldInitializationFinished
protected boolean isFieldInitializationFinished()- Returns:
- true, if the fields of the binding are fully initialized.
-
canBeInstantiated
public boolean canBeInstantiated()Answer true if the receiver can be instantiated- Overrides:
canBeInstantiatedin classTypeBinding
-
canBeSeenBy
Answer true if the receiver is visible to the invocationPackage. -
canBeSeenBy
Answer true if the receiver is visible to the receiverType and the invocationType. -
innerCanBeSeenBy
public final boolean innerCanBeSeenBy(ReferenceBinding receiverType, ReferenceBinding invocationType) -
canBeSeenBy
Answer true if the receiver is visible to the type provided by the scope.- Overrides:
canBeSeenByin classTypeBinding
-
innerCanBeSeenBy
-
computeGenericTypeSignature
-
computeId
public void computeId() -
computeId
-
computeUniqueKey
public char[] computeUniqueKey(boolean isLeaf) p.X<T extends Y & I, U extends Y> -> Lp/X<TT;TU;>;- Overrides:
computeUniqueKeyin classBinding
-
constantPoolName
public char[] constantPoolName()Answer the receiver's constant pool name. NOTE: This method should only be used during/after code gen.- Specified by:
constantPoolNamein classTypeBinding
-
debugName
- Overrides:
debugNamein classTypeBinding
-
depth
public int depth()- Overrides:
depthin classTypeBinding
-
detectAnnotationCycle
public boolean detectAnnotationCycle() -
enclosingTypeAt
-
enumConstantCount
public int enumConstantCount() -
fieldCount
public int fieldCount() -
fields
-
getAccessFlags
public final int getAccessFlags() -
getAnnotations
- Overrides:
getAnnotationsin classBinding- Returns:
- the JSR 175 annotations for this type.
-
getAnnotationTagBits
public long getAnnotationTagBits()Description copied from class:BindingCompute the tagbits for standard annotations. For source types, these could require lazily resolving corresponding annotation nodes, in case of forward references. For type use bindings, this method still returns the tagbits corresponding to the type declaration binding.- Overrides:
getAnnotationTagBitsin classBinding- See Also:
-
getEnclosingInstancesSlotSize
public int getEnclosingInstancesSlotSize()- Returns:
- the enclosingInstancesSlotSize
-
getExactConstructor
-
getExactMethod
public MethodBinding getExactMethod(char[] selector, TypeBinding[] argumentTypes, CompilationUnitScope refScope) -
getField
-
getComponent
-
getRecordComponent
-
getField
Where multiple fields with the same name are defined, this will return the one most visible one... Added for AspectJ to allow proper lookup with inter-type fields -
getFileName
public char[] getFileName()- See Also:
-
getMemberType
Find the member type with the given simple typeName. Benefits from the fact that the array ofmemberTypes()is sorted. -
getMethods
- Overrides:
getMethodsin classTypeBinding
-
getMethods
-
getOuterLocalVariablesSlotSize
public int getOuterLocalVariablesSlotSize()- Returns:
- the outerLocalVariablesSlotSize
-
getPackage
- Specified by:
getPackagein classTypeBinding
-
getTypeVariable
-
hashCode
-
hasIncompatibleSuperType
Returns true if the two types have an incompatible common supertype, e.g.List<String>andList<Integer> -
hasMemberTypes
public boolean hasMemberTypes() -
acceptsNonNullDefault
public boolean acceptsNonNullDefault()Description copied from class:TypeBindingUsed to implement this sentence from o.e.j.annotation.DefaultLocation: "Wildcards and the use of type variables are always excluded from NonNullByDefault."- Overrides:
acceptsNonNullDefaultin classTypeBinding
-
hasRestrictedAccess
public final boolean hasRestrictedAccess() -
hasNullBit
public boolean hasNullBit(int mask) Query typeBits without triggering supertype lookup. -
implementsInterface
Answer true if the receiver implements anInterface or is identical to anInterface. If searchHierarchy is true, then also search the receiver's superclasses. NOTE: Assume that anInterface is an interface. -
isAbstract
public final boolean isAbstract()Answer true if the receiver is an abstract type -
isAnnotationType
public boolean isAnnotationType()- Overrides:
isAnnotationTypein classBinding
-
isBinaryBinding
public final boolean isBinaryBinding() -
isClass
public boolean isClass()- Overrides:
isClassin classTypeBinding
-
isNestmateOf
-
isProperType
public boolean isProperType(boolean admitCapture18) Description copied from class:TypeBindingJLS8 Sect 18.1.1- Overrides:
isProperTypein classTypeBinding- Parameters:
admitCapture18- request ifCaptureBinding18shuld be considered as a proper type. If unsure say 'true', only inScope.greaterLowerBound(TypeBinding[], Scope, LookupEnvironment)CaptureBinding18 has to be excluded to prevent an NPE on a branch that heuristically tries to avoid inconsistent intersections.
-
isCompatibleWith
Answer true if the receiver type can be assigned to the argument type (right) In addition to improving performance, caching also ensures there is no infinite regression since per nature, the compatibility check is recursive through parameterized type arguments (122775)- Specified by:
isCompatibleWithin classTypeBinding
-
isNonSealed
public final boolean isNonSealed()Answer true if the receiver has non-sealed modifier -
isSealed
public boolean isSealed()Answer true if the receiver has sealed modifier -
isSubtypeOf
- Overrides:
isSubtypeOfin classTypeBinding
-
isSubTypeOfRTL
-
isDefault
public final boolean isDefault()Answer true if the receiver has default visibility -
isDeprecated
public final boolean isDeprecated()Answer true if the receiver is a deprecated type -
isEnum
public boolean isEnum()- Overrides:
isEnumin classTypeBinding
-
isFinal
public final boolean isFinal()Answer true if the receiver is final and cannot be subclassed -
isHierarchyBeingConnected
public boolean isHierarchyBeingConnected()Returns true if the type hierarchy is being connected -
isHierarchyBeingActivelyConnected
public boolean isHierarchyBeingActivelyConnected()Returns true if the type hierarchy is being connected "actively" i.e not paused momentatrily, while resolving type arguments. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=294057 -
isHierarchyConnected
public boolean isHierarchyConnected()Returns true if the type hierarchy is connected -
isInterface
public boolean isInterface()- Overrides:
isInterfacein classTypeBinding
-
isFunctionalInterface
- Overrides:
isFunctionalInterfacein classTypeBinding
-
isPrivate
public final boolean isPrivate()Answer true if the receiver has private visibility -
isOrEnclosedByPrivateType
public final boolean isOrEnclosedByPrivateType()Answer true if the receiver or any of its enclosing types have private visibility -
isProtected
public final boolean isProtected()Answer true if the receiver has protected visibility -
isInPreconstructorContext
public final boolean isInPreconstructorContext()Answer true if the receiver definition is in preconstructor context - true only in such cases for anonymous type - Java 22 - preview - JEP 447 -
isPublic
public final boolean isPublic()Answer true if the receiver has public visibility -
isStatic
public final boolean isStatic()Answer true if the receiver is a static member type (or toplevel)- Overrides:
isStaticin classTypeBinding
-
isStrictfp
public final boolean isStrictfp()Answer true if all float operations must adher to IEEE 754 float/double rules -
isSuperclassOf
Answer true if the receiver is in the superclass hierarchy of aType NOTE: Object.isSuperclassOf(Object) -> false -
isThrowable
public boolean isThrowable()Description copied from class:TypeBindingReturns true if a given type may be thrown- Overrides:
isThrowablein classTypeBinding- See Also:
-
isUncheckedException
public boolean isUncheckedException(boolean includeSupertype) JLS 11.5 ensures that Throwable, Exception, RuntimeException and Error are directly connected.(Throwable<- Exception <- RumtimeException, Throwable <- Error). Thus no need to check #isCompatibleWith but rather check in type IDs so as to avoid some eager class loading for JCL writers. When 'includeSupertype' is true, answers true if the given type can be a supertype of some unchecked exception type (i.e. Throwable or Exception).- Overrides:
isUncheckedExceptionin classTypeBinding- See Also:
-
isUsed
public final boolean isUsed()Answer true if the receiver has private visibility and is used locally -
isViewedAsDeprecated
public final boolean isViewedAsDeprecated()Answer true if the receiver is deprecated (or any of its enclosing types) -
isImplicitType
public boolean isImplicitType() -
memberTypes
Returns the member types of this type sorted by simple name. -
methods
-
outermostEnclosingType
-
qualifiedSourceName
public char[] qualifiedSourceName()Answer the source name for the type. In the case of member types, as the qualified name from its top level type. For example, for a member type N defined insideM & A: "A.M.N".- Specified by:
qualifiedSourceNamein classTypeBinding
-
readableName
public char[] readableName()Answer the receiver's signature. NOTE: This method should only be used during/after code gen.- Specified by:
readableNamein classBinding
-
readableName
public char[] readableName(boolean showGenerics) -
appendNullAnnotation
-
retrieveAnnotationHolder
-
setAnnotations
- Overrides:
setAnnotationsin classBinding
-
setContainerAnnotationType
-
tagAsHavingDefectiveContainerType
public void tagAsHavingDefectiveContainerType() -
nullAnnotatedReadableName
Description copied from class:TypeBindingAnswer a readable name (for error reporting) that includes nullness type annotations.- Overrides:
nullAnnotatedReadableNamein classTypeBinding- See Also:
-
shortReadableName
public char[] shortReadableName()- Overrides:
shortReadableNamein classBinding
-
shortReadableName
public char[] shortReadableName(boolean showGenerics) -
signature
public char[] signature()Description copied from class:TypeBindingAnswer the receiver classfile signature. Arrays and base types do not distinguish between signature() and constantPoolName(). NOTE: This method should only be used during/after code gen.- Overrides:
signaturein classTypeBinding
-
sourceName
public char[] sourceName()- Specified by:
sourceNamein classTypeBinding
-
upwardsProjection
Perform an upwards type projection as per JLS 4.10.5- Overrides:
upwardsProjectionin classTypeBinding- Parameters:
scope- Relevant scope for evaluating type projectionmentionedTypeVariables- Filter for mentioned type variabled- Returns:
- Upwards type projection of 'this', or null if downwards projection is undefined
-
downwardsProjection
Perform a downwards type projection as per JLS 4.10.5- Overrides:
downwardsProjectionin classTypeBinding- Parameters:
scope- Relevant scope for evaluating type projectionmentionedTypeVariables- Filter for mentioned type variabled- Returns:
- Downwards type projection of 'this', or null if downwards projection is undefined
-
superclass
- Overrides:
superclassin classTypeBinding
-
permittedTypes
- Overrides:
permittedTypesin classTypeBinding
-
superInterfaces
- Overrides:
superInterfacesin classTypeBinding
-
syntheticEnclosingInstanceTypes
-
unResolvedFields
-
unResolvedComponents
-
applyCloseableClassWhitelists
-
hasMethodWithNumArgs
protected boolean hasMethodWithNumArgs(char[] selector, int numArgs) -
applyCloseableInterfaceWhitelists
-
detectWrapperResource
public void detectWrapperResource() -
getInterfaceAbstractContracts
protected MethodBinding[] getInterfaceAbstractContracts(Scope scope, boolean replaceWildcards, boolean filterDefaultMethods) throws org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding.InvalidBindingException - Throws:
org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding.InvalidBindingException
-
getSingleAbstractMethod
Description copied from class:TypeBindingReturn the single abstract method of a functional interface, or one ofnullorsamProblemBinding, if the receiver is not a functional interface as defined in JLS 9.8. In particularnullis answered if the receiver is not a reference type, or is a problem type.- Overrides:
getSingleAbstractMethodin classTypeBinding- Parameters:
scope- scopereplaceWildcards- Should wildcards be replaced following JLS 9.8? Say false for lambdas with explicit argument types which should apply 18.5.3- Returns:
- The single abstract method of a functional interface, or one of
nullorsamProblemBinding, if the receiver is not a functional interface.
-
isConsistentIntersection
-
module
-
hasEnclosingInstanceContext
public boolean hasEnclosingInstanceContext()
-