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
- Direct Known Subclasses:
IntersectionTypeBinding18
,ParameterizedTypeBinding
,ProblemReferenceBinding
,SourceTypeBinding
,TypeVariableBinding
,UnresolvedReferenceBinding
,WildcardBinding
-
Field Summary
Modifier and TypeFieldDescriptionchar[][]
static final ReferenceBinding
int
protected static ProblemMethodBinding
protected 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, VOID
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
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Used to implement this sentence from o.e.j.annotation.DefaultLocation: "Wildcards and the use of type variables are always excluded from NonNullByDefault."protected void
appendNullAnnotation
(StringBuilder nameBuffer, CompilerOptions options) protected int
protected int
Return the array of resolvable fields (resilience)Return the array of resolvable methods (resilience)static FieldBinding
binarySearch
(char[] name, FieldBinding[] sortedFields) static long
binarySearch
(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.boolean
Answer true if the receiver can be instantiatedboolean
canBeSeenBy
(PackageBinding invocationPackage) Answer true if the receiver is visible to the invocationPackage.boolean
canBeSeenBy
(ReferenceBinding receiverType, ReferenceBinding invocationType) Answer true if the receiver is visible to the receiverType and the invocationType.boolean
canBeSeenBy
(Scope scope) Answer true if the receiver is visible to the type provided by the scope.char[]
computeGenericTypeSignature
(TypeVariableBinding[] typeVariables) void
void
computeId
(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.int
depth()
boolean
void
downwardsProjection
(Scope scope, TypeBinding[] mentionedTypeVariables) Perform a downwards type projection as per JLS 4.10.5final ReferenceBinding
enclosingTypeAt
(int relativeDepth) int
int
fields()
final int
long
Compute the tagbits for standard annotations.getComponent
(char[] componentName, boolean needResolve) int
getExactConstructor
(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) int
getRecordComponent
(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 ofnull
orsamProblemBinding
, if the receiver is not a functional interface as defined in JLS 9.8.getTypeVariable
(char[] variableName) boolean
int
hashCode()
boolean
boolean
hasIncompatibleSuperType
(ReferenceBinding otherType) Returns true if the two types have an incompatible common supertype, e.g.boolean
protected boolean
hasMethodWithNumArgs
(char[] selector, int numArgs) boolean
hasNullBit
(int mask) Query typeBits without triggering supertype lookup.final boolean
boolean
implementsInterface
(ReferenceBinding anInterface, boolean searchHierarchy) Answer true if the receiver implements anInterface or is identical to anInterface.final boolean
innerCanBeSeenBy
(ReferenceBinding receiverType, ReferenceBinding invocationType) final boolean
innerCanBeSeenBy
(Scope scope) final boolean
Answer true if the receiver is an abstract typeboolean
final boolean
boolean
isClass()
boolean
isCompatibleWith
(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 boolean
isConsistentIntersection
(TypeBinding[] intersectingTypes) final boolean
Answer true if the receiver has default visibilityfinal boolean
Answer true if the receiver is a deprecated typeboolean
isEnum()
protected boolean
final boolean
isFinal()
Answer true if the receiver is final and cannot be subclassedboolean
isFunctionalInterface
(Scope scope) boolean
Returns true if the type hierarchy is being connected "actively" i.e not paused momentatrily, while resolving type arguments.boolean
Returns true if the type hierarchy is being connectedboolean
Returns true if the type hierarchy is connectedboolean
boolean
isNestmateOf
(ReferenceBinding other) final boolean
Answer true if the receiver has non-sealed modifierfinal boolean
Answer true if the receiver or any of its enclosing types have private visibilityfinal boolean
Answer true if the receiver has private visibilityboolean
isProperType
(boolean admitCapture18) JLS8 Sect 18.1.1final boolean
Answer true if the receiver has protected visibilityfinal boolean
isPublic()
Answer true if the receiver has public visibilityboolean
isSealed()
Answer true if the receiver has sealed modifierfinal boolean
isStatic()
Answer true if the receiver is a static member type (or toplevel)final boolean
Answer true if all float operations must adher to IEEE 754 float/double rulesboolean
isSubtypeOf
(TypeBinding other, boolean simulatingBugJDK8026527) protected boolean
isSubTypeOfRTL
(TypeBinding other) boolean
isSuperclassOf
(ReferenceBinding otherType) Answer true if the receiver is in the superclass hierarchy of aType NOTE: Object.isSuperclassOf(Object) -> falseboolean
Returns true if a given type may be thrownboolean
isUncheckedException
(boolean includeSupertype) JLS 11.5 ensures that Throwable, Exception, RuntimeException and Error are directly connected.final boolean
isUsed()
Answer true if the receiver has private visibility and is used locallyfinal boolean
Answer 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 ReferenceBinding
char[]
Answer the source name for the type.char[]
Answer the receiver's signature.char[]
readableName
(boolean showGenerics) retrieveAnnotationHolder
(Binding binding, boolean forceInitialization) void
setAnnotations
(AnnotationBinding[] annotations, boolean forceStore) void
void
char[]
char[]
shortReadableName
(boolean showGenerics) char[]
Answer the receiver classfile signature.static void
sortFields
(FieldBinding[] sortedFields, int left, int right) Sort the field array using a quicksortstatic void
sortMethods
(MethodBinding[] sortedMethods, int left, int right) Sort the field array using a quicksortchar[]
void
upwardsProjection
(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, typeVariables, unannotated, uncapture, updateTagBits, wellKnownBaseType, wellKnownType, withoutToplevelNullAnnotation
Methods 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:
canBeInstantiated
in 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:
canBeSeenBy
in 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:
computeUniqueKey
in 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:
constantPoolName
in classTypeBinding
-
debugName
- Overrides:
debugName
in classTypeBinding
-
depth
public int depth()- Overrides:
depth
in classTypeBinding
-
detectAnnotationCycle
public boolean detectAnnotationCycle() -
enclosingTypeAt
-
enumConstantCount
public int enumConstantCount() -
fieldCount
public int fieldCount() -
fields
-
getAccessFlags
public final int getAccessFlags() -
getAnnotations
- Overrides:
getAnnotations
in classBinding
- Returns:
- the JSR 175 annotations for this type.
-
getAnnotationTagBits
public long getAnnotationTagBits()Description copied from class:Binding
Compute 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:
getAnnotationTagBits
in 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:
getMethods
in classTypeBinding
-
getMethods
-
getOuterLocalVariablesSlotSize
public int getOuterLocalVariablesSlotSize()- Returns:
- the outerLocalVariablesSlotSize
-
getPackage
- Specified by:
getPackage
in classTypeBinding
-
getTypeVariable
-
hashCode
public int 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:TypeBinding
Used to implement this sentence from o.e.j.annotation.DefaultLocation: "Wildcards and the use of type variables are always excluded from NonNullByDefault."- Overrides:
acceptsNonNullDefault
in 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:
isAnnotationType
in classBinding
-
isBinaryBinding
public final boolean isBinaryBinding() -
isClass
public boolean isClass()- Overrides:
isClass
in classTypeBinding
-
isNestmateOf
-
isProperType
public boolean isProperType(boolean admitCapture18) Description copied from class:TypeBinding
JLS8 Sect 18.1.1- Overrides:
isProperType
in classTypeBinding
- Parameters:
admitCapture18
- request ifCaptureBinding18
shuld 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:
isCompatibleWith
in 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:
isSubtypeOf
in 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:
isEnum
in 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:
isInterface
in classTypeBinding
-
isFunctionalInterface
- Overrides:
isFunctionalInterface
in 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 -
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:
isStatic
in 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:TypeBinding
Returns true if a given type may be thrown- Overrides:
isThrowable
in 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:
isUncheckedException
in 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) -
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:
qualifiedSourceName
in classTypeBinding
-
readableName
public char[] readableName()Answer the receiver's signature. NOTE: This method should only be used during/after code gen.- Specified by:
readableName
in classBinding
-
readableName
public char[] readableName(boolean showGenerics) -
appendNullAnnotation
-
retrieveAnnotationHolder
-
setAnnotations
- Overrides:
setAnnotations
in classBinding
-
setContainerAnnotationType
-
tagAsHavingDefectiveContainerType
public void tagAsHavingDefectiveContainerType() -
nullAnnotatedReadableName
Description copied from class:TypeBinding
Answer a readable name (for error reporting) that includes nullness type annotations.- Overrides:
nullAnnotatedReadableName
in classTypeBinding
- See Also:
-
shortReadableName
public char[] shortReadableName()- Overrides:
shortReadableName
in classBinding
-
shortReadableName
public char[] shortReadableName(boolean showGenerics) -
signature
public char[] signature()Description copied from class:TypeBinding
Answer 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:
signature
in classTypeBinding
-
sourceName
public char[] sourceName()- Specified by:
sourceName
in classTypeBinding
-
upwardsProjection
Perform an upwards type projection as per JLS 4.10.5- Overrides:
upwardsProjection
in 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:
downwardsProjection
in 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:
superclass
in classTypeBinding
-
permittedTypes
- Overrides:
permittedTypes
in classTypeBinding
-
superInterfaces
- Overrides:
superInterfaces
in 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:TypeBinding
Return the single abstract method of a functional interface, or one ofnull
orsamProblemBinding
, if the receiver is not a functional interface as defined in JLS 9.8. In particularnull
is answered if the receiver is not a reference type, or is a problem type.- Overrides:
getSingleAbstractMethod
in 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
null
orsamProblemBinding
, if the receiver is not a functional interface.
-
isConsistentIntersection
-
module
-
hasEnclosingInstanceContext
public boolean hasEnclosingInstanceContext()
-