public class WildcardBinding extends ReferenceBinding
  • Field Details

  • Constructor Details

    • WildcardBinding

      public WildcardBinding(ReferenceBinding genericType, int rank, TypeBinding bound, TypeBinding[] otherBounds, int boundKind, LookupEnvironment environment)
      When unbound, the bound denotes the corresponding type variable (so as to retrieve its bound lazily)
  • Method Details

    • allBounds

      public TypeBinding allBounds()
    • setTypeAnnotations

      public void setTypeAnnotations(AnnotationBinding[] annotations, boolean evalNullAnnotations)
      Overrides:
      setTypeAnnotations in class TypeBinding
    • evaluateNullAnnotations

      public void evaluateNullAnnotations(Scope scope, Wildcard wildcard)
      evaluate null type annotations and check / copy nullTagBits from bound and typevariable. may be invoked repeatedly.
      Parameters:
      scope - (may be null, if wildcard is null)
      wildcard - (may be null. if non-null, errors are reported and type annotations are dropped from this.bound in case of conflicts.)
    • determineNullBitsFromDeclaration

      public long determineNullBitsFromDeclaration(Scope scope, Wildcard wildcard)
      compute the nullTagBits from type annotations and bound.
      Parameters:
      scope - (may be null, if wildcard is null)
      wildcard - (may be null. if non-null, errors are reported and type annotations are dropped from this.bound in case of conflicts.)
    • actualType

      public ReferenceBinding actualType()
      Overrides:
      actualType in class TypeBinding
    • kind

      public int kind()
      Overrides:
      kind in class TypeBinding
    • boundCheck

      public boolean boundCheck(TypeBinding argumentType)
      Returns true if the argument type satisfies the wildcard bound(s)
    • canBeInstantiated

      public boolean canBeInstantiated()
      Description copied from class: ReferenceBinding
      Answer true if the receiver can be instantiated
      Overrides:
      canBeInstantiated in class ReferenceBinding
      See Also:
      • invalid reference
        org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#canBeInstantiated()
    • collectMissingTypes

      public List<TypeBinding> collectMissingTypes(List<TypeBinding> missingTypes)
      Description copied from class: TypeBinding
      Iterate through the type components to collect instances of leaf missing types
      Overrides:
      collectMissingTypes in class TypeBinding
      Returns:
      missing types
      See Also:
      • invalid reference
        org.eclipse.jdt.internal.compiler.lookup.TypeBinding#collectMissingTypes(java.util.List)
    • collectSubstitutes

      public void collectSubstitutes(Scope scope, TypeBinding actualType, InferenceContext inferenceContext, int constraint)
      Collect the substitutes into a map for certain type variables inside the receiver type e.g. Collection<T>.collectSubstitutes(Collection<List<X>>, Map) will populate Map with: T --> List<X> Constraints:
      
         A << F   corresponds to:   F.collectSubstitutes(..., A, ..., CONSTRAINT_EXTENDS (1))
         A = F    corresponds to:   F.collectSubstitutes(..., A, ..., CONSTRAINT_EQUAL (0))
         A >> F   corresponds to:   F.collectSubstitutes(..., A, ..., CONSTRAINT_SUPER (2))
       
      Overrides:
      collectSubstitutes in class TypeBinding
    • computeUniqueKey

      public char[] computeUniqueKey(boolean isLeaf)
      Description copied from class: ReferenceBinding
      p.X<T extends Y & I, U extends Y> -> Lp/X<TT;TU;>;
      Overrides:
      computeUniqueKey in class ReferenceBinding
    • constantPoolName

      public char[] constantPoolName()
      Description copied from class: ReferenceBinding
      Answer the receiver's constant pool name. NOTE: This method should only be used during/after code gen.
      Overrides:
      constantPoolName in class ReferenceBinding
      See Also:
      • invalid reference
        org.eclipse.jdt.internal.compiler.lookup.TypeBinding#constantPoolName()
    • clone

      public TypeBinding clone(TypeBinding immaterial)
      Description copied from class: TypeBinding
      Virtual copy constructor: a copy is made of the receiver's entire instance state and then suitably parameterized by the arguments to the clone operation as seen fit by each type. Parameters may not make sense for every type in the hierarchy, in which case they are silently ignored. A type may choose to retain a copy of the prototype for reference.
      Overrides:
      clone in class TypeBinding
    • annotatedDebugName

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

      public String debugName()
      Overrides:
      debugName in class ReferenceBinding
      See Also:
      • invalid reference
        org.eclipse.jdt.internal.compiler.lookup.TypeBinding#debugName()
    • erasure

      public TypeBinding erasure()
      Overrides:
      erasure in class TypeBinding
    • genericTypeSignature

      public char[] genericTypeSignature()
      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:
      genericTypeSignature in class TypeBinding
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class ReferenceBinding
    • hasTypeBit

      public boolean hasTypeBit(int bit)
      Description copied from class: TypeBinding
      Answer an additional bit characterizing this type, like TypeIds.BitAutoCloseable.
      Overrides:
      hasTypeBit in class TypeBinding
    • isSuperclassOf

      public boolean isSuperclassOf(ReferenceBinding otherType)
      Description copied from class: ReferenceBinding
      Answer true if the receiver is in the superclass hierarchy of aType NOTE: Object.isSuperclassOf(Object) -> false
      Overrides:
      isSuperclassOf in class ReferenceBinding
      See Also:
      • invalid reference
        org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#isSuperclassOf(org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding)
    • isIntersectionType

      public boolean isIntersectionType()
      Description copied from class: TypeBinding
      Returns true if the current type denotes an intersection type: Number and Comparable<?>
      Overrides:
      isIntersectionType in class TypeBinding
    • getIntersectingTypes

      public ReferenceBinding[] getIntersectingTypes()
      Overrides:
      getIntersectingTypes in class TypeBinding
    • isHierarchyConnected

      public boolean isHierarchyConnected()
      Description copied from class: ReferenceBinding
      Returns true if the type hierarchy is connected
      Overrides:
      isHierarchyConnected in class ReferenceBinding
    • enterRecursiveFunction

      public boolean enterRecursiveFunction()
      Description copied from class: TypeBinding
      Call this before descending into type details to prevent infinite recursion.
      Overrides:
      enterRecursiveFunction in class TypeBinding
      Returns:
      true if a recursion was not already started.
    • exitRecursiveFunction

      public void exitRecursiveFunction()
      Description copied from class: TypeBinding
      Exit the context of a potentially recursive function.
      Overrides:
      exitRecursiveFunction in class TypeBinding
    • isProperType

      public boolean isProperType(boolean admitCapture18)
      Description copied from class: TypeBinding
      JLS8 Sect 18.1.1
      Overrides:
      isProperType in class ReferenceBinding
      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.
    • isUnboundWildcard

      public boolean isUnboundWildcard()
      Description copied from class: TypeBinding
      Returns true if wildcard type of the form '?' (no bound)
      Overrides:
      isUnboundWildcard in class TypeBinding
    • isWildcard

      public boolean isWildcard()
      Description copied from class: TypeBinding
      Returns true if the type is a wildcard
      Overrides:
      isWildcard in class TypeBinding
    • readableName

      public char[] readableName()
      Description copied from class: ReferenceBinding
      Answer the receiver's signature. NOTE: This method should only be used during/after code gen.
      Overrides:
      readableName in class ReferenceBinding
    • 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 ReferenceBinding
      See Also:
      • invalid reference
        org.eclipse.jdt.internal.compiler.lookup.TypeBinding#nullAnnotatedReadableName(CompilerOptions,boolean)
    • shortReadableName

      public char[] shortReadableName()
      Overrides:
      shortReadableName in class ReferenceBinding
    • 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 class ReferenceBinding
      See Also:
      • invalid reference
        org.eclipse.jdt.internal.compiler.lookup.TypeBinding#signature()
    • sourceName

      public char[] sourceName()
      Overrides:
      sourceName in class ReferenceBinding
    • superclass

      public ReferenceBinding superclass()
      Overrides:
      superclass in class ReferenceBinding
    • superInterfaces

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

      public void swapUnresolved(UnresolvedReferenceBinding unresolvedType, ReferenceBinding resolvedType, LookupEnvironment env)
      Overrides:
      swapUnresolved in class TypeBinding
    • toString

      public String toString()
      Overrides:
      toString in class Object
      See Also:
    • typeVariable

      public TypeVariableBinding typeVariable()
      Returns associated type variable, or null in case of inconsistency
    • unannotated

      public TypeBinding unannotated()
      Description copied from class: TypeBinding
      Return this type minus its type annotations
      Overrides:
      unannotated in class TypeBinding
    • withoutToplevelNullAnnotation

      public TypeBinding withoutToplevelNullAnnotation()
      Description copied from class: TypeBinding
      Return this type minus its toplevel null annotations. Any annotations on type arguments or bounds are retained.
      Overrides:
      withoutToplevelNullAnnotation in class TypeBinding
    • uncapture

      public TypeBinding uncapture(Scope scope)
      Description copied from class: TypeBinding
      Perform capture "deconversion" on a given type
      Overrides:
      uncapture in class TypeBinding
    • mentionsAny

      public boolean mentionsAny(TypeBinding[] parameters, int idx)
      Description copied from class: TypeBinding
      Does this type mention any of the given type parameters, except the one at position 'idx'?
      Overrides:
      mentionsAny in class TypeBinding
    • 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 ReferenceBinding
    • updateTagBits

      public long updateTagBits()
      Description copied from class: TypeBinding
      Refresh some tagBits from details into the main type. Currently handled: TagBits.HasNullTypeAnnotation
      Overrides:
      updateTagBits in class TypeBinding
    • isNonDenotable

      public boolean isNonDenotable()
      Description copied from class: TypeBinding
      Does this type lack a class file representation on its own ?
      Overrides:
      isNonDenotable in class TypeBinding