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

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.TypeVariableBinding
All Implemented Interfaces:
IDependent
Direct Known Subclasses:
CaptureBinding

public class TypeVariableBinding
extends ReferenceBinding

Binding for a type parameter, held by source/binary type or method.


Field Summary
 Binding declaringElement
           
 TypeBinding firstBound
          Denote the first explicit (binding) bound amongst the supertypes (from declaration in source) If no superclass was specified, then it denotes the first superinterface, or null if none was specified.
 char[] genericTypeSignature
           
 int rank
           
 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, 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, VARIABLE, WILDCARD_TYPE
 
Fields inherited from interface org.eclipse.jdt.internal.compiler.env.IDependent
JAR_FILE_ENTRY_SEPARATOR
 
Constructor Summary
TypeVariableBinding(char[] sourceName, Binding declaringElement, int rank)
           
 
Method Summary
 int boundCheck(Substitution substitution, TypeBinding argumentType)
          Returns true if the argument type satisfies all bounds of the type parameter
 boolean canBeInstantiated()
           
 void collectSubstitutes(Scope scope, TypeBinding actualType, java.util.Map substitutes, int constraint)
          Collect the substitutes into a map for certain type variables inside the receiver type e.g.
 char[] computeUniqueKey(boolean isLeaf)
           
 char[] constantPoolName()
          Answer the receiver's constant pool name.
 java.lang.String debugName()
           
 TypeBinding erasure()
           
 char[] genericSignature()
          T::Ljava/util/Map;:Ljava/io/Serializable; T:LY
 char[] genericTypeSignature()
          T::Ljava/util/Map;:Ljava/io/Serializable; T:LY
 boolean isErasureBoundTo(TypeBinding type)
          Returns true if the type variable is directly bound to a given type
 boolean isInterchangeableWith(LookupEnvironment environment, TypeVariableBinding otherVariable)
          Returns true if the 2 variables are playing exact same role: they have the same bounds, providing one is substituted with the other: > is interchangeable with >.
 boolean isTypeVariable()
          Returns true if the type was declared as a type variable
 int kind()
           
 TypeVariableBinding original()
          Returns the original type variable for a given variable.
 char[] readableName()
           
 char[] shortReadableName()
           
 ReferenceBinding superclass()
           
 ReferenceBinding[] superInterfaces()
           
 java.lang.String toString()
           
 TypeBinding upperBound()
          Upper bound doesn't perform erasure
 
Methods inherited from class org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding
availableFields, availableMethods, binarySearch, binarySearch, canBeSeenBy, canBeSeenBy, canBeSeenBy, computeGenericTypeSignature, computeId, depth, detectAnnotationCycle, enclosingTypeAt, enumConstantCount, fieldCount, fields, findSuperTypeErasingTo, getAccessFlags, getAnnotations, getAnnotationTagBits, getExactConstructor, getExactMethod, getField, getFileName, getMemberType, getMethods, getPackage, getTypeVariable, hashCode, hasIncompatibleSuperType, hasMemberTypes, hasRestrictedAccess, implementsInterface, isAbstract, isAnnotationType, isBinaryBinding, isClass, isCompatibleWith, isDefault, isDeprecated, isEnum, isFinal, isHierarchyBeingConnected, isInterface, isPrivate, isProtected, isPublic, isStatic, isStrictfp, isSuperclassOf, isUncheckedException, isUsed, isViewedAsDeprecated, memberTypes, methods, outermostEnclosingType, qualifiedSourceName, setAnnotations, signature, sortFields, sortMethods, sourceName, syntheticEnclosingInstanceTypes, syntheticOuterLocalVariables
 
Methods inherited from class org.eclipse.jdt.internal.compiler.lookup.TypeBinding
capture, dimensions, enclosingType, findSuperTypeWithSameErasure, genericCast, isAnonymousType, isArrayType, isBaseType, isBoundParameterizedType, isCapture, isEquivalentTo, isGenericType, isHierarchyInconsistent, isIntersectingWith, isIntersectionType, isLocalType, isMemberType, isNestedType, isNumericType, isParameterizedType, isParameterizedWithOwnVariables, isProvablyDistinctFrom, isRawType, isReifiable, isTypeArgumentContainedBy, isTypeArgumentIntersecting, isUnboundWildcard, isWildcard, leafComponentType, needsUncheckedConversion, qualifiedPackageName, swapUnresolved, typeVariables, wellKnownType
 
Methods inherited from class org.eclipse.jdt.internal.compiler.lookup.Binding
computeUniqueKey, initializeDeprecatedAnnotationTagBits, isValidBinding, problemId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

declaringElement

public Binding declaringElement

rank

public int rank

firstBound

public TypeBinding firstBound
Denote the first explicit (binding) bound amongst the supertypes (from declaration in source) If no superclass was specified, then it denotes the first superinterface, or null if none was specified.


superclass

public ReferenceBinding superclass

superInterfaces

public ReferenceBinding[] superInterfaces

genericTypeSignature

public char[] genericTypeSignature
Constructor Detail

TypeVariableBinding

public TypeVariableBinding(char[] sourceName,
                           Binding declaringElement,
                           int rank)
Method Detail

kind

public int kind()
Overrides:
kind in class TypeBinding

boundCheck

public int boundCheck(Substitution substitution,
                      TypeBinding argumentType)
Returns true if the argument type satisfies all bounds of the type parameter


canBeInstantiated

public boolean canBeInstantiated()
Overrides:
canBeInstantiated in class ReferenceBinding
See Also:
ReferenceBinding.canBeInstantiated()

collectSubstitutes

public void collectSubstitutes(Scope scope,
                               TypeBinding actualType,
                               java.util.Map substitutes,
                               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, ..., 1) A = F corresponds to: F.collectSubstitutes(..., A, ..., 0) A >> F corresponds to: F.collectSubstitutes(..., A, ..., 2)

Overrides:
collectSubstitutes in class TypeBinding

constantPoolName

public char[] constantPoolName()
Description copied from class: TypeBinding
Answer the receiver's constant pool name. NOTE: This method should only be used during/after code gen. e.g. 'java/lang/Object'

Overrides:
constantPoolName in class ReferenceBinding

computeUniqueKey

public char[] computeUniqueKey(boolean isLeaf)
Overrides:
computeUniqueKey in class ReferenceBinding

debugName

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

erasure

public TypeBinding erasure()
Overrides:
erasure in class TypeBinding

genericSignature

public char[] genericSignature()
T::Ljava/util/Map;:Ljava/io/Serializable; T:LY


genericTypeSignature

public char[] genericTypeSignature()
T::Ljava/util/Map;:Ljava/io/Serializable; T:LY

Overrides:
genericTypeSignature in class TypeBinding

isErasureBoundTo

public boolean isErasureBoundTo(TypeBinding type)
Returns true if the type variable is directly bound to a given type


isInterchangeableWith

public boolean isInterchangeableWith(LookupEnvironment environment,
                                     TypeVariableBinding otherVariable)
Returns true if the 2 variables are playing exact same role: they have the same bounds, providing one is substituted with the other: > is interchangeable with >.


isTypeVariable

public boolean isTypeVariable()
Returns true if the type was declared as a type variable

Overrides:
isTypeVariable in class TypeBinding

original

public TypeVariableBinding original()
Returns the original type variable for a given variable. Only different from receiver for type variables of generic methods of parameterized types e.g. X { U foo(V1) } --> X { String foo(V2) } and V2.original() --> V1


readableName

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

shortReadableName

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

superclass

public ReferenceBinding superclass()
Overrides:
superclass in class ReferenceBinding

superInterfaces

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

toString

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

upperBound

public TypeBinding upperBound()
Upper bound doesn't perform erasure