org.eclipse.jdt.internal.compiler.lookup
Class ParameterizedTypeBinding

java.lang.Object
  extended by org.eclipse.jdt.internal.compiler.lookup.Binding
      extended by org.eclipse.jdt.internal.compiler.lookup.TypeBinding
          extended by org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding
              extended by org.eclipse.jdt.internal.compiler.lookup.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 Summary
 TypeBinding[] arguments
           
 LookupEnvironment environment
           
 FieldBinding[] fields
           
 char[] genericTypeSignature
           
 ReferenceBinding[] memberTypes
           
 MethodBinding[] methods
           
 ReferenceBinding superclass
           
 ReferenceBinding[] superInterfaces
           
 
Fields inherited from class org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding
compoundName, fPackage, LUB_GENERIC, modifiers, sourceName
 
Fields inherited from class org.eclipse.jdt.internal.compiler.lookup.TypeBinding
BOOLEAN, BYTE, CHAR, DOUBLE, FLOAT, id, INT, LONG, NULL, SHORT, tagBits, VOID
 
Fields inherited from class org.eclipse.jdt.internal.compiler.lookup.Binding
ANY_EXCEPTION, ARRAY_TYPE, BASE_TYPE, FIELD, GENERIC_TYPE, IMPORT, INTERSECTION_TYPE, LOCAL, METHOD, NO_ANNOTATIONS, NO_ELEMENT_VALUE_PAIRS, NO_EXCEPTIONS, NO_FIELDS, NO_MEMBER_TYPES, NO_METHODS, NO_PARAMETERS, NO_SUPERINTERFACES, NO_TYPE_VARIABLES, NO_TYPES, PACKAGE, PARAMETERIZED_TYPE, RAW_TYPE, TYPE, TYPE_PARAMETER, UNINITIALIZED_FIELDS, UNINITIALIZED_METHODS, UNINITIALIZED_REFERENCE_TYPES, VARIABLE, WILDCARD_TYPE
 
Constructor Summary
ParameterizedTypeBinding(ReferenceBinding type, TypeBinding[] arguments, ReferenceBinding enclosingType, LookupEnvironment environment)
           
 
Method Summary
protected  ReferenceBinding actualType()
          May return an UnresolvedReferenceBinding.
 void boundCheck(Scope scope, TypeReference[] argumentReferences)
          Iterate type arguments, and validate them according to corresponding variable bounds.
 boolean canBeInstantiated()
          Answer true if the receiver can be instantiated
 TypeBinding capture(Scope scope, int position)
          Perform capture conversion for a parameterized type with wildcard arguments
 List collectMissingTypes(List missingTypes)
          Iterate through the type components to collect instances of leaf missing types
 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.
 void computeId()
           
 char[] computeUniqueKey(boolean isLeaf)
          p.X {} -> Lp/X;
 char[] constantPoolName()
          Answer the receiver's constant pool name.
 ParameterizedMethodBinding createParameterizedMethod(MethodBinding originalMethod)
           
 String debugName()
           
 ReferenceBinding enclosingType()
           
 LookupEnvironment environment()
          Returns the lookup environment
 TypeBinding erasure()
           
 int fieldCount()
           
 FieldBinding[] fields()
           
 ReferenceBinding genericType()
          Return the original generic type from which the parameterized type got instantiated from.
 char[] genericTypeSignature()
          Ltype
 long getAnnotationTagBits()
          Compute the tagbits for standard annotations.
 int getEnclosingInstancesSlotSize()
           
 MethodBinding getExactConstructor(TypeBinding[] argumentTypes)
           
 MethodBinding getExactMethod(char[] selector, TypeBinding[] argumentTypes, CompilationUnitScope refScope)
           
 FieldBinding getField(char[] fieldName, boolean needResolve)
           
 ReferenceBinding getMemberType(char[] typeName)
           
 MethodBinding[] getMethods(char[] selector)
           
 int getOuterLocalVariablesSlotSize()
           
 boolean hasMemberTypes()
           
 boolean implementsMethod(MethodBinding method)
           
protected  void initializeArguments()
           
 boolean isEquivalentTo(TypeBinding otherType)
          Returns true if a type is identical to another one, or for generic types, true if compared to its raw type.
 boolean isHierarchyConnected()
          Returns true if the type hierarchy is connected
 boolean isRawSubstitution()
          Returns true for raw substitution
 int kind()
           
 ReferenceBinding[] memberTypes()
           
 MethodBinding[] methods()
           
 int problemId()
          Define to be able to get the computeId() for the inner type binding.
 char[] qualifiedPackageName()
          Answer the qualified name of the receiver's package separated by periods or an empty string if its the default package.
 char[] qualifiedSourceName()
          Answer the source name for the type.
 char[] readableName()
          Answer the receiver's signature.
 char[] shortReadableName()
           
 char[] signature()
          Answer the receiver classfile signature.
 char[] sourceName()
           
 TypeBinding substitute(TypeVariableBinding originalVariable)
          Returns the type substitute for a given type variable, or itself if no substitution got performed.
 ReferenceBinding superclass()
           
 ReferenceBinding[] superInterfaces()
           
 void swapUnresolved(UnresolvedReferenceBinding unresolvedType, ReferenceBinding resolvedType, LookupEnvironment env)
           
 ReferenceBinding[] syntheticEnclosingInstanceTypes()
           
 SyntheticArgumentBinding[] syntheticOuterLocalVariables()
           
 String toString()
           
 TypeVariableBinding[] typeVariables()
           
 FieldBinding[] unResolvedFields()
           
 
Methods inherited from class org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding
availableFields, availableMethods, binarySearch, binarySearch, canBeSeenBy, canBeSeenBy, canBeSeenBy, computeGenericTypeSignature, depth, detectAnnotationCycle, enclosingTypeAt, enumConstantCount, getAccessFlags, getAnnotations, getFileName, getMethods, getPackage, getTypeVariable, hashCode, hasIncompatibleSuperType, hasRestrictedAccess, implementsInterface, isAbstract, isAnnotationType, isBinaryBinding, isClass, isCompatibleWith, isDefault, isDeprecated, isEnum, isFinal, isHierarchyBeingActivelyConnected, isHierarchyBeingConnected, isInterface, isOrEnclosedByPrivateType, isPrivate, isProtected, isPublic, isStatic, isStrictfp, isSuperclassOf, isThrowable, isUncheckedException, isUsed, isViewedAsDeprecated, outermostEnclosingType, retrieveAnnotationHolder, setAnnotations, sortFields, sortMethods
 
Methods inherited from class org.eclipse.jdt.internal.compiler.lookup.TypeBinding
closestMatch, dimensions, findSuperTypeOriginatingFrom, findSuperTypeOriginatingFrom, genericCast, getErasureCompatibleType, isAnonymousType, isArrayType, isBaseType, isBoundParameterizedType, isCapture, isGenericType, isHierarchyInconsistent, isIntersectionType, isLocalType, isMemberType, isNestedType, isNumericType, isParameterizedType, isParameterizedTypeWithActualArguments, isParameterizedWithOwnVariables, isProvablyDistinct, isRawType, isReifiable, isTypeArgumentContainedBy, isTypeVariable, isUnboundWildcard, isWildcard, leafComponentType, needsUncheckedConversion, original, wellKnownType
 
Methods inherited from class org.eclipse.jdt.internal.compiler.lookup.Binding
computeUniqueKey, initializeDeprecatedAnnotationTagBits, isParameter, isValidBinding, isVolatile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

arguments

public TypeBinding[] arguments

environment

public LookupEnvironment environment

genericTypeSignature

public char[] genericTypeSignature

superclass

public ReferenceBinding superclass

superInterfaces

public ReferenceBinding[] superInterfaces

fields

public FieldBinding[] fields

memberTypes

public ReferenceBinding[] memberTypes

methods

public MethodBinding[] methods
Constructor Detail

ParameterizedTypeBinding

public ParameterizedTypeBinding(ReferenceBinding type,
                                TypeBinding[] arguments,
                                ReferenceBinding enclosingType,
                                LookupEnvironment environment)
Method Detail

actualType

protected ReferenceBinding actualType()
May return an UnresolvedReferenceBinding.

See Also:
genericType()

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:
ReferenceBinding.canBeInstantiated()

capture

public TypeBinding capture(Scope scope,
                           int position)
Perform capture conversion for a parameterized type with wildcard arguments

Overrides:
capture in class TypeBinding
See Also:
TypeBinding.capture(Scope,int)

collectMissingTypes

public List collectMissingTypes(List 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:
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.collectSubstitutes(Collection>, Map), will populate Map with: T --> List 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:
ReferenceBinding.computeId()

computeUniqueKey

public char[] computeUniqueKey(boolean isLeaf)
Description copied from class: ReferenceBinding
p.X {} -> Lp/X;

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:
TypeBinding.constantPoolName()

createParameterizedMethod

public ParameterizedMethodBinding createParameterizedMethod(MethodBinding originalMethod)

debugName

public String debugName()
Overrides:
debugName in class ReferenceBinding
See Also:
TypeBinding.debugName()

enclosingType

public ReferenceBinding enclosingType()
Overrides:
enclosingType in class TypeBinding
See Also:
TypeBinding.enclosingType()

environment

public LookupEnvironment environment()
Description copied from interface: Substitution
Returns the lookup environment

Specified by:
environment in interface Substitution
See Also:
Substitution.environment()

erasure

public TypeBinding erasure()
Overrides:
erasure in class TypeBinding
See Also:
TypeBinding.erasure()

fieldCount

public int fieldCount()
Overrides:
fieldCount in class ReferenceBinding
See Also:
ReferenceBinding.fieldCount()

fields

public FieldBinding[] fields()
Overrides:
fields in class ReferenceBinding
See Also:
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:
if no resolution is required (unlikely)

genericTypeSignature

public char[] genericTypeSignature()
Ltype; LY;

Overrides:
genericTypeSignature in class TypeBinding

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.

Overrides:
getAnnotationTagBits in class ReferenceBinding
See Also:
ReferenceBinding.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:
ReferenceBinding.getExactConstructor(TypeBinding[])

getExactMethod

public MethodBinding getExactMethod(char[] selector,
                                    TypeBinding[] argumentTypes,
                                    CompilationUnitScope refScope)
Overrides:
getExactMethod in class ReferenceBinding
See Also:
ReferenceBinding.getExactMethod(char[], TypeBinding[],CompilationUnitScope)

getField

public FieldBinding getField(char[] fieldName,
                             boolean needResolve)
Overrides:
getField in class ReferenceBinding
See Also:
ReferenceBinding.getField(char[], boolean)

getMemberType

public ReferenceBinding getMemberType(char[] typeName)
Overrides:
getMemberType in class ReferenceBinding
See Also:
ReferenceBinding.getMemberType(char[])

getMethods

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

getOuterLocalVariablesSlotSize

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

hasMemberTypes

public boolean hasMemberTypes()
Overrides:
hasMemberTypes in class ReferenceBinding

implementsMethod

public boolean implementsMethod(MethodBinding method)
See Also:
ReferenceBinding.implementsMethod(MethodBinding)

initializeArguments

protected void initializeArguments()

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

isRawSubstitution

public boolean isRawSubstitution()
Description copied from interface: Substitution
Returns true for raw substitution

Specified by:
isRawSubstitution in interface Substitution
See Also:
Substitution.isRawSubstitution()

kind

public int kind()
Overrides:
kind in class TypeBinding

memberTypes

public ReferenceBinding[] memberTypes()
Overrides:
memberTypes in class ReferenceBinding
See Also:
ReferenceBinding.memberTypes()

methods

public MethodBinding[] methods()
Overrides:
methods in class ReferenceBinding
See Also:
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:
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:
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:
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:
Binding.readableName()

shortReadableName

public char[] shortReadableName()
Overrides:
shortReadableName in class ReferenceBinding
See Also:
Binding.shortReadableName()

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 ReferenceBinding
See Also:
TypeBinding.signature()

sourceName

public char[] sourceName()
Overrides:
sourceName in class ReferenceBinding
See Also:
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:
Substitution.substitute(org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding)

superclass

public ReferenceBinding superclass()
Overrides:
superclass in class ReferenceBinding
See Also:
ReferenceBinding.superclass()

superInterfaces

public ReferenceBinding[] superInterfaces()
Overrides:
superInterfaces in class ReferenceBinding
See Also:
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:
ReferenceBinding.syntheticEnclosingInstanceTypes()

syntheticOuterLocalVariables

public SyntheticArgumentBinding[] syntheticOuterLocalVariables()
Overrides:
syntheticOuterLocalVariables in class ReferenceBinding
See Also:
ReferenceBinding.syntheticOuterLocalVariables()

toString

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

typeVariables

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

unResolvedFields

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


Copyright © 2012. All Rights Reserved.