Direct Known Subclasses:
IntersectionTypeBinding18, ParameterizedTypeBinding, ProblemReferenceBinding, SourceTypeBinding, TypeVariableBinding, UnresolvedReferenceBinding, WildcardBinding

public abstract class ReferenceBinding extends TypeBinding
  • Field Details

    • compoundName

      public char[][] compoundName
    • sourceName

      public char[] sourceName
    • modifiers

      public int modifiers
    • fPackage

      public PackageBinding fPackage
    • singleAbstractMethod

      protected MethodBinding[] singleAbstractMethod
    • LUB_GENERIC

      public static final ReferenceBinding LUB_GENERIC
    • samProblemBinding

      protected static ProblemMethodBinding samProblemBinding
  • Constructor Details

    • ReferenceBinding

      public ReferenceBinding(ReferenceBinding prototype)
    • ReferenceBinding

      public ReferenceBinding()
  • Method Details

    • binarySearch

      public static FieldBinding binarySearch(char[] name, FieldBinding[] sortedFields)
    • binarySearch

      public 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. -1 means no method got found
      Parameters:
      selector -
      sortedMethods -
      Returns:
      (start + (end<<32)) or -1 if no method found
    • sortFields

      public static void sortFields(FieldBinding[] sortedFields, int left, int right)
      Sort the field array using a quicksort
    • sortMethods

      public static void sortMethods(MethodBinding[] sortedMethods, int left, int right)
      Sort the field array using a quicksort
    • availableFields

      public FieldBinding[] availableFields()
      Return the array of resolvable fields (resilience)
    • availableMethods

      public MethodBinding[] availableMethods()
      Return the array of resolvable methods (resilience)
    • hasHierarchyCheckStarted

      public boolean hasHierarchyCheckStarted()
    • setHierarchyCheckDone

      public void setHierarchyCheckDone()
    • canBeInstantiated

      public boolean canBeInstantiated()
      Answer true if the receiver can be instantiated
      Overrides:
      canBeInstantiated in class TypeBinding
    • canBeSeenBy

      public boolean canBeSeenBy(PackageBinding invocationPackage)
      Answer true if the receiver is visible to the invocationPackage.
    • canBeSeenBy

      public boolean canBeSeenBy(ReferenceBinding receiverType, ReferenceBinding invocationType)
      Answer true if the receiver is visible to the receiverType and the invocationType.
    • innerCanBeSeenBy

      public final boolean innerCanBeSeenBy(ReferenceBinding receiverType, ReferenceBinding invocationType)
    • canBeSeenBy

      public boolean canBeSeenBy(Scope scope)
      Answer true if the receiver is visible to the type provided by the scope.
      Overrides:
      canBeSeenBy in class TypeBinding
    • innerCanBeSeenBy

      public final boolean innerCanBeSeenBy(Scope scope)
    • computeGenericTypeSignature

      public char[] computeGenericTypeSignature(TypeVariableBinding[] typeVariables)
    • computeId

      public void computeId()
    • computeId

      public void computeId(LookupEnvironment environment)
    • computeUniqueKey

      public char[] computeUniqueKey(boolean isLeaf)
      p.X {} -> Lp/X;
      Overrides:
      computeUniqueKey in class Binding
    • 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 class TypeBinding
    • debugName

      public String debugName()
      Overrides:
      debugName in class TypeBinding
    • depth

      public int depth()
      Overrides:
      depth in class TypeBinding
    • detectAnnotationCycle

      public boolean detectAnnotationCycle()
    • enclosingTypeAt

      public final ReferenceBinding enclosingTypeAt(int relativeDepth)
    • enumConstantCount

      public int enumConstantCount()
    • fieldCount

      public int fieldCount()
    • fields

      public FieldBinding[] fields()
    • components

      public RecordComponentBinding[] components()
    • getAccessFlags

      public final int getAccessFlags()
    • getAnnotations

      public AnnotationBinding[] getAnnotations()
      Overrides:
      getAnnotations in class Binding
      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 class Binding
      See Also:
      Binding.getAnnotationTagBits()
    • getEnclosingInstancesSlotSize

      public int getEnclosingInstancesSlotSize()
      Returns:
      the enclosingInstancesSlotSize
    • getExactConstructor

      public MethodBinding getExactConstructor(TypeBinding[] argumentTypes)
    • getExactMethod

      public MethodBinding getExactMethod(char[] selector, TypeBinding[] argumentTypes, CompilationUnitScope refScope)
    • getField

      public FieldBinding getField(char[] fieldName, boolean needResolve)
    • getField

      public FieldBinding 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... Added for AspectJ to allow proper lookup with inter-type fields
    • getFileName

      public char[] getFileName()
      See Also:
      IDependent.getFileName()
    • getMemberType

      public ReferenceBinding getMemberType(char[] typeName)
      Find the member type with the given simple typeName. Benefits from the fact that the array of memberTypes() is sorted.
    • getMethods

      public MethodBinding[] getMethods(char[] selector)
      Overrides:
      getMethods in class TypeBinding
    • getMethods

      public MethodBinding[] getMethods(char[] selector, int suggestedParameterLength)
    • getOuterLocalVariablesSlotSize

      public int getOuterLocalVariablesSlotSize()
      Returns:
      the outerLocalVariablesSlotSize
    • getPackage

      public PackageBinding getPackage()
      Specified by:
      getPackage in class TypeBinding
    • getTypeVariable

      public TypeVariableBinding getTypeVariable(char[] variableName)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • hasIncompatibleSuperType

      public boolean hasIncompatibleSuperType(ReferenceBinding otherType)
      Returns true if the two types have an incompatible common supertype, e.g. List and List
    • 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 class TypeBinding
    • hasRestrictedAccess

      public final boolean hasRestrictedAccess()
    • hasNullBit

      public boolean hasNullBit(int mask)
      Query typeBits without triggering supertype lookup.
    • implementsInterface

      public boolean implementsInterface(ReferenceBinding anInterface, boolean searchHierarchy)
      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 class Binding
    • isBinaryBinding

      public final boolean isBinaryBinding()
    • isClass

      public boolean isClass()
      Overrides:
      isClass in class TypeBinding
    • isNestmateOf

      public boolean isNestmateOf(ReferenceBinding other)
    • isProperType

      public boolean isProperType(boolean admitCapture18)
      Description copied from class: TypeBinding
      JLS8 Sect 18.1.1
      Overrides:
      isProperType in class TypeBinding
      Parameters:
      admitCapture18 - request if CaptureBinding18 shuld be considered as a proper type. If unsure say 'true', only in Scope.greaterLowerBound(TypeBinding[], Scope, LookupEnvironment) CaptureBinding18 has to be excluded to prevent an NPE on a branch that heuristically tries to avoid inconsistent intersections.
    • isCompatibleWith

      public 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)
      Specified by:
      isCompatibleWith in class TypeBinding
    • 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

      public boolean isSubtypeOf(TypeBinding other, boolean simulatingBugJDK8026527)
      Overrides:
      isSubtypeOf in class TypeBinding
    • isSubTypeOfRTL

      protected boolean isSubTypeOfRTL(TypeBinding other)
    • 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 class TypeBinding
    • 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 class TypeBinding
    • isFunctionalInterface

      public boolean isFunctionalInterface(Scope scope)
      Overrides:
      isFunctionalInterface in class TypeBinding
    • 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 class TypeBinding
    • isStrictfp

      public final boolean isStrictfp()
      Answer true if all float operations must adher to IEEE 754 float/double rules
    • isSuperclassOf

      public boolean isSuperclassOf(ReferenceBinding otherType)
      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 class TypeBinding
      See Also:
      TypeBinding.isThrowable()
    • 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 class TypeBinding
      See Also:
      TypeBinding.isUncheckedException(boolean)
    • 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

      public ReferenceBinding[] memberTypes()
      Returns the member types of this type sorted by simple name.
    • methods

      public MethodBinding[] methods()
    • outermostEnclosingType

      public final ReferenceBinding 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 inside M & A: "A.M.N".
      Specified by:
      qualifiedSourceName in class TypeBinding
    • readableName

      public char[] readableName()
      Answer the receiver's signature. NOTE: This method should only be used during/after code gen.
      Specified by:
      readableName in class Binding
    • readableName

      public char[] readableName(boolean showGenerics)
    • appendNullAnnotation

      protected void appendNullAnnotation(StringBuffer nameBuffer, CompilerOptions options)
    • retrieveAnnotationHolder

      public AnnotationHolder retrieveAnnotationHolder(Binding binding, boolean forceInitialization)
    • setAnnotations

      public void setAnnotations(AnnotationBinding[] annotations, boolean forceStore)
      Overrides:
      setAnnotations in class Binding
    • setContainerAnnotationType

      public void setContainerAnnotationType(ReferenceBinding value)
    • tagAsHavingDefectiveContainerType

      public void tagAsHavingDefectiveContainerType()
    • nullAnnotatedReadableName

      public char[] nullAnnotatedReadableName(CompilerOptions options, boolean shortNames)
      Description copied from class: TypeBinding
      Answer a readable name (for error reporting) that includes nullness type annotations.
      Overrides:
      nullAnnotatedReadableName in class TypeBinding
      See Also:
      TypeBinding.nullAnnotatedReadableName(CompilerOptions,boolean)
    • shortReadableName

      public char[] shortReadableName()
      Overrides:
      shortReadableName in class Binding
    • shortReadableName

      public char[] shortReadableName(boolean showGenerics)
    • signature

      public char[] signature()
      Description copied from class: TypeBinding
      Answer the receiver classfile signature. Arrays & base types do not distinguish between signature() & constantPoolName(). NOTE: This method should only be used during/after code gen.
      Overrides:
      signature in class TypeBinding
    • sourceName

      public char[] sourceName()
      Specified by:
      sourceName in class TypeBinding
    • upwardsProjection

      public ReferenceBinding upwardsProjection(Scope scope, TypeBinding[] mentionedTypeVariables)
      Perform an upwards type projection as per JLS 4.10.5
      Overrides:
      upwardsProjection in class TypeBinding
      Parameters:
      scope - Relevant scope for evaluating type projection
      mentionedTypeVariables - Filter for mentioned type variabled
    • downwardsProjection

      public ReferenceBinding downwardsProjection(Scope scope, TypeBinding[] mentionedTypeVariables)
      Perform a downwards type projection as per JLS 4.10.5
      Overrides:
      downwardsProjection in class TypeBinding
      Parameters:
      scope - Relevant scope for evaluating type projection
      mentionedTypeVariables - Filter for mentioned type variabled
    • superclass

      public ReferenceBinding superclass()
      Overrides:
      superclass in class TypeBinding
    • permittedTypes

      public ReferenceBinding[] permittedTypes()
      Overrides:
      permittedTypes in class TypeBinding
    • superInterfaces

      public ReferenceBinding[] superInterfaces()
      Overrides:
      superInterfaces in class TypeBinding
    • syntheticEnclosingInstanceTypes

      public ReferenceBinding[] syntheticEnclosingInstanceTypes()
    • unResolvedFields

      public FieldBinding[] unResolvedFields()
    • applyCloseableClassWhitelists

      protected int applyCloseableClassWhitelists(CompilerOptions options)
    • hasMethodWithNumArgs

      protected boolean hasMethodWithNumArgs(char[] selector, int numArgs)
    • applyCloseableInterfaceWhitelists

      protected int applyCloseableInterfaceWhitelists()
    • getInterfaceAbstractContracts

      protected MethodBinding[] getInterfaceAbstractContracts(Scope scope, boolean replaceWildcards, boolean filterDefaultMethods) throws InvalidInputException
      Throws:
      InvalidInputException
    • getSingleAbstractMethod

      public MethodBinding getSingleAbstractMethod(Scope scope, boolean replaceWildcards)
      Description copied from class: TypeBinding
      Return the single abstract method of a functional interface, or one of null or samProblemBinding, if the receiver is not a functional interface as defined in JLS 9.8. In particular null is answered if the receiver is not a reference type, or is a problem type.
      Overrides:
      getSingleAbstractMethod in class TypeBinding
      Parameters:
      scope - scope
      replaceWildcards - 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 or samProblemBinding, if the receiver is not a functional interface.
    • isConsistentIntersection

      public static boolean isConsistentIntersection(TypeBinding[] intersectingTypes)
    • module

      public ModuleBinding module()
    • hasEnclosingInstanceContext

      public boolean hasEnclosingInstanceContext()