Class ParameterizedTypeBinding

All Implemented Interfaces:
Substitution
Direct Known Subclasses:
RawTypeBinding

public class ParameterizedTypeBinding extends ReferenceBinding implements Substitution
A parameterized type encapsulates a type with type arguments,
  • Field Details

  • Constructor Details

  • Method Details

    • actualType

      public ReferenceBinding actualType()
      May return an UnresolvedReferenceBinding.
      Overrides:
      actualType in class TypeBinding
      See Also:
    • isParameterizedType

      public boolean isParameterizedType()
      Description copied from class: TypeBinding
      Returns true if the type is parameterized, e.g. List<String>. Note that some instances of ParameterizedTypeBinding have no arguments, like for non-generic members of a parameterized type. Use TypeBinding.isParameterizedTypeWithActualArguments() instead to find out.
      Overrides:
      isParameterizedType in class TypeBinding
    • isRecord

      public boolean isRecord()
      Overrides:
      isRecord in class TypeBinding
    • components

      public RecordComponentBinding[] components()
      Overrides:
      components in class TypeBinding
    • boundCheck

      public void boundCheck(Scope scope, TypeReference[] argumentReferences)
      Iterate type arguments, and validate them according to corresponding variable bounds.
    • 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()
    • capture

      public ParameterizedTypeBinding capture(Scope scope, int start, int end)
      Perform capture conversion for a parameterized type with wildcard arguments
      Overrides:
      capture in class TypeBinding
      See Also:
      • invalid reference
        org.eclipse.jdt.internal.compiler.lookup.TypeBinding#capture(Scope,int, int)
    • uncapture

      public TypeBinding uncapture(Scope scope)
      Perform capture deconversion for a parameterized type with captured wildcard arguments
      Overrides:
      uncapture in class TypeBinding
      See Also:
      • invalid reference
        org.eclipse.jdt.internal.compiler.lookup.TypeBinding#uncapture(Scope)
    • 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
    • computeId

      public void computeId()
      Overrides:
      computeId in class ReferenceBinding
      See Also:
      • invalid reference
        org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#computeId()
    • 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 outerType)
      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
    • createParameterizedMethod

      public ParameterizedMethodBinding createParameterizedMethod(MethodBinding originalMethod)
    • debugName

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

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

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

      public LookupEnvironment environment()
      Description copied from interface: Substitution
      Returns the lookup environment
      Specified by:
      environment in interface Substitution
      See Also:
      • invalid reference
        org.eclipse.jdt.internal.compiler.lookup.Substitution#environment()
    • erasure

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

      public ReferenceBinding upwardsProjection(Scope scope, TypeBinding[] mentionedTypeVariables)
      Description copied from class: ReferenceBinding
      Perform an upwards type projection as per JLS 4.10.5
      Overrides:
      upwardsProjection in class ReferenceBinding
      Parameters:
      scope - Relevant scope for evaluating type projection
      mentionedTypeVariables - Filter for mentioned type variabled
      Returns:
      Upwards type projection of 'this', or null if downwards projection is undefined
    • downwardsProjection

      public ReferenceBinding downwardsProjection(Scope scope, TypeBinding[] mentionedTypeVariables)
      Description copied from class: ReferenceBinding
      Perform a downwards type projection as per JLS 4.10.5
      Overrides:
      downwardsProjection in class ReferenceBinding
      Parameters:
      scope - Relevant scope for evaluating type projection
      mentionedTypeVariables - Filter for mentioned type variabled
      Returns:
      Downwards type projection of 'this', or null if downwards projection is undefined
    • fieldCount

      public int fieldCount()
      Overrides:
      fieldCount in class ReferenceBinding
      See Also:
      • invalid reference
        org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#fieldCount()
    • fields

      public FieldBinding[] fields()
      Overrides:
      fields in class ReferenceBinding
      See Also:
      • invalid reference
        org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#fields()
    • genericType

      public ReferenceBinding genericType()
      Return the original generic type from which the parameterized type got instantiated from. This will perform lazy resolution automatically if needed.
      See Also:
    • genericTypeSignature

      public char[] genericTypeSignature()
      
       Ltype<param1 ... paramN>;
       LY<TT;>;
       
      Overrides:
      genericTypeSignature in class TypeBinding
    • getAnnotations

      public AnnotationBinding[] getAnnotations()
      Overrides:
      getAnnotations in class ReferenceBinding
      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 ReferenceBinding
      See Also:
      • invalid reference
        org.eclipse.jdt.internal.compiler.lookup.Binding#getAnnotationTagBits()
    • getEnclosingInstancesSlotSize

      public int getEnclosingInstancesSlotSize()
      Overrides:
      getEnclosingInstancesSlotSize in class ReferenceBinding
      Returns:
      the enclosingInstancesSlotSize
    • getExactConstructor

      public MethodBinding getExactConstructor(TypeBinding[] argumentTypes)
      Overrides:
      getExactConstructor in class ReferenceBinding
      See Also:
      • invalid reference
        org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#getExactConstructor(TypeBinding[])
    • getExactMethodBase

      public MethodBinding getExactMethodBase(char[] selector, TypeBinding[] argumentTypes, CompilationUnitScope refScope)
      See Also:
      • invalid reference
        org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#getExactMethod(char[], TypeBinding[],CompilationUnitScope)
    • getField

      public FieldBinding getField(char[] fieldName, boolean needResolve)
      Overrides:
      getField in class ReferenceBinding
      See Also:
      • invalid reference
        org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#getField(char[], boolean)
    • getComponent

      public RecordComponentBinding getComponent(char[] name, boolean needResolve)
      Overrides:
      getComponent in class ReferenceBinding
      See Also:
      • invalid reference
        org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#getComponent(char[], boolean)
    • getRecordComponent

      public RecordComponentBinding getRecordComponent(char[] name)
      Overrides:
      getRecordComponent in class ReferenceBinding
    • getMethodsBase

      public MethodBinding[] getMethodsBase(char[] selector)
      See Also:
      • invalid reference
        org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#getMethods(char[])
    • getOuterLocalVariablesSlotSize

      public int getOuterLocalVariablesSlotSize()
      Overrides:
      getOuterLocalVariablesSlotSize in class ReferenceBinding
      Returns:
      the outerLocalVariablesSlotSize
    • hasMemberTypes

      public boolean hasMemberTypes()
      Overrides:
      hasMemberTypes 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
    • hasMethodWithNumArgs

      protected boolean hasMethodWithNumArgs(char[] selector, int numArgs)
      Overrides:
      hasMethodWithNumArgs in class ReferenceBinding
    • hasValueBasedTypeAnnotation

      public boolean hasValueBasedTypeAnnotation()
      Overrides:
      hasValueBasedTypeAnnotation in class TypeBinding
    • implementsMethod

      public boolean implementsMethod(MethodBinding method)
      See Also:
      • invalid reference
        org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#implementsMethod(MethodBinding)
    • initializeArguments

      protected void initializeArguments()
    • isBoundParameterizedType

      public boolean isBoundParameterizedType()
      Description copied from class: TypeBinding
      Returns true if parameterized type AND not of the form List<?>
      Overrides:
      isBoundParameterizedType in class TypeBinding
    • isEquivalentTo

      public boolean isEquivalentTo(TypeBinding otherType)
      Description copied from class: TypeBinding
      Returns true if a type is identical to another one, or for generic types, true if compared to its raw type.
      Overrides:
      isEquivalentTo 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
    • 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.
    • isRawSubstitution

      public boolean isRawSubstitution()
      Description copied from interface: Substitution
      Returns true for raw substitution
      Specified by:
      isRawSubstitution in interface Substitution
      See Also:
      • invalid reference
        org.eclipse.jdt.internal.compiler.lookup.Substitution#isRawSubstitution()
    • permittedTypes

      public ReferenceBinding[] permittedTypes()
      Overrides:
      permittedTypes in class ReferenceBinding
    • 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
    • kind

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

      public ReferenceBinding[] memberTypes()
      Description copied from class: ReferenceBinding
      Returns the member types of this type sorted by simple name.
      Overrides:
      memberTypes in class ReferenceBinding
      See Also:
      • invalid reference
        org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#memberTypes()
    • 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
    • methods

      public MethodBinding[] methods()
      Overrides:
      methods in class ReferenceBinding
      See Also:
      • invalid reference
        org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#methods()
    • problemId

      public int problemId()
      Define to be able to get the computeId() for the inner type binding.
      Overrides:
      problemId in class Binding
      See Also:
      • invalid reference
        org.eclipse.jdt.internal.compiler.lookup.Binding#problemId()
    • qualifiedPackageName

      public char[] qualifiedPackageName()
      Description copied from class: TypeBinding
      Answer the qualified name of the receiver's package separated by periods or an empty string if its the default package. For example, {java.util}.
      Overrides:
      qualifiedPackageName in class TypeBinding
      See Also:
      • invalid reference
        org.eclipse.jdt.internal.compiler.lookup.TypeBinding#qualifiedPackageName()
    • qualifiedSourceName

      public char[] qualifiedSourceName()
      Description copied from class: ReferenceBinding
      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".
      Overrides:
      qualifiedSourceName in class ReferenceBinding
      See Also:
      • invalid reference
        org.eclipse.jdt.internal.compiler.lookup.TypeBinding#qualifiedSourceName()
    • 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
      See Also:
      • invalid reference
        org.eclipse.jdt.internal.compiler.lookup.Binding#readableName()
    • readableName

      public char[] readableName(boolean showGenerics)
      Overrides:
      readableName in class ReferenceBinding
    • shortReadableName

      public char[] shortReadableName()
      Overrides:
      shortReadableName in class ReferenceBinding
      See Also:
      • invalid reference
        org.eclipse.jdt.internal.compiler.lookup.Binding#shortReadableName()
    • shortReadableName

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

      public TypeBinding substitute(TypeVariableBinding originalVariable)
      Description copied from interface: Substitution
      Returns the type substitute for a given type variable, or itself if no substitution got performed.
      Specified by:
      substitute in interface Substitution
      See Also:
      • invalid reference
        org.eclipse.jdt.internal.compiler.lookup.Substitution#substitute(org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding)
    • superclass

      public ReferenceBinding superclass()
      Overrides:
      superclass in class ReferenceBinding
      See Also:
      • invalid reference
        org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#superclass()
    • superInterfaces

      public ReferenceBinding[] superInterfaces()
      Overrides:
      superInterfaces in class ReferenceBinding
      See Also:
      • invalid reference
        org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#superInterfaces()
    • swapUnresolved

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

      public ReferenceBinding[] syntheticEnclosingInstanceTypes()
      Overrides:
      syntheticEnclosingInstanceTypes in class ReferenceBinding
      See Also:
      • invalid reference
        org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#syntheticEnclosingInstanceTypes()
    • syntheticOuterLocalVariables

      public SyntheticArgumentBinding[] syntheticOuterLocalVariables()
      Overrides:
      syntheticOuterLocalVariables in class TypeBinding
      See Also:
      • invalid reference
        org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#syntheticOuterLocalVariables()
    • toString

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

      public TypeVariableBinding[] typeVariables()
      Overrides:
      typeVariables in class TypeBinding
    • typeArguments

      public TypeBinding[] typeArguments()
    • unResolvedFields

      public FieldBinding[] unResolvedFields()
      Overrides:
      unResolvedFields in class ReferenceBinding
    • unResolvedComponents

      public RecordComponentBinding[] unResolvedComponents()
      Overrides:
      unResolvedComponents in class ReferenceBinding
    • getInterfaceAbstractContracts

      protected MethodBinding[] getInterfaceAbstractContracts(Scope scope, boolean replaceWildcards, boolean filterDefaultMethods) throws org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding.InvalidBindingException
      Overrides:
      getInterfaceAbstractContracts in class ReferenceBinding
      Throws:
      org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding.InvalidBindingException
    • 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 ReferenceBinding.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 ReferenceBinding
      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 ReferenceBinding.samProblemBinding, if the receiver is not a functional interface.
    • getSingleAbstractMethod

      public MethodBinding getSingleAbstractMethod(Scope scope, boolean replaceWildcards, int start, int end)
    • getNonWildcardParameters

      public TypeBinding[] getNonWildcardParameters(Scope scope)
    • getNonWildcardParameterization

      public ReferenceBinding getNonWildcardParameterization(BlockScope blockScope)
    • 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
    • getField

      public FieldBinding getField(char[] fieldName, boolean resolve, InvocationSite site, Scope scope)
      Description copied from class: ReferenceBinding
      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
      Overrides:
      getField in class ReferenceBinding
    • getExactMethod

      public MethodBinding getExactMethod(char[] selector, TypeBinding[] argumentTypes, CompilationUnitScope refScope)
      Overrides:
      getExactMethod in class ReferenceBinding
    • getMethods

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