Package randoop.types
Class ExplicitTypeVariable
- java.lang.Object
-
- randoop.types.Type
-
- randoop.types.ReferenceType
-
- randoop.types.ParameterType
-
- randoop.types.TypeVariable
-
- randoop.types.ExplicitTypeVariable
-
- All Implemented Interfaces:
Comparable<Type>
class ExplicitTypeVariable extends TypeVariable
Represents a type variable that is a type parameter. (See JLS, section 4.3.)
-
-
Field Summary
Fields Modifier and Type Field Description private TypeVariable<?>
variable
The type parameter.
-
Constructor Summary
Constructors Constructor Description ExplicitTypeVariable(TypeVariable<?> variable, ParameterBound bound)
Create aExplicitTypeVariable
for the given type parameter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TypeVariable
createCopyWithBounds(ParameterBound lowerBound, ParameterBound upperBound)
boolean
equals(Object obj)
String
getBinaryName()
Returns the binary name of this type, including type arguments if this is a parameterized type (so, it isn't really a binary name).String
getFqName()
Returns the fully-qualified name of this type, including type arguments if this is a parameterized type.(package private) TypeVariable<?>
getReflectionTypeVariable()
String
getSimpleName()
Returns the name of this type without type arguments or package qualifiers.int
hashCode()
boolean
isGeneric(boolean ignoreWildcards)
Indicate whether this type is generic.ReferenceType
substitute(Substitution substitution)
Applies a substitution to aReferenceType
.-
Methods inherited from class randoop.types.TypeVariable
canBeInstantiatedBy, forType, getRawtype, getTypeParameters, isAssignableFrom, isInstantiationOf, isSubtypeOf, isVariable
-
Methods inherited from class randoop.types.ParameterType
getCanonicalName, getLowerTypeBound, getRuntimeClass, getUpperTypeBound, hasCaptureVariable, hasGenericBound, hasWildcard, setLowerBound, setUpperBound, toString
-
Methods inherited from class randoop.types.ReferenceType
applyCaptureConversion, forClass, getInstantiatingSubstitution, getInstantiatingSubstitutionforTypeVariable, isCaptureVariable, isReferenceType
-
Methods inherited from class randoop.types.Type
compareTo, forFullyQualifiedName, forName, forValue, getTypeforFullyQualifiedName, getUnqualifiedBinaryName, isArray, isAssignableFromTypeOf, isBoxedPrimitive, isClass, isClassOrInterfaceType, isEnum, isGeneric, isInterface, isNonreceiverType, isObject, isParameterized, isPrimitive, isRawtype, isString, isVoid, runtimeClassIs
-
-
-
-
Field Detail
-
variable
private final TypeVariable<?> variable
The type parameter.
-
-
Constructor Detail
-
ExplicitTypeVariable
ExplicitTypeVariable(TypeVariable<?> variable, ParameterBound bound)
Create aExplicitTypeVariable
for the given type parameter.- Parameters:
variable
- the type parameterbound
- the upper bound on the parameter
-
-
Method Detail
-
equals
public boolean equals(Object obj)
Checks that the type parameter is equal. This may be more restrictive than desired because equivalent TypeVariable objects from different instances of the same type may be distinct.
- Overrides:
equals
in classParameterType
- Returns:
- true if the type parameters are equal, false otherwise
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classParameterType
-
getFqName
public String getFqName()
Description copied from class:Type
Returns the fully-qualified name of this type, including type arguments if this is a parameterized type. Forjava.util.List<T>
return"java.util.List<T>"
.
-
getBinaryName
public String getBinaryName()
Description copied from class:Type
Returns the binary name of this type, including type arguments if this is a parameterized type (so, it isn't really a binary name). Forjava.util.List<T>
return"java.util.List<T>"
.- Specified by:
getBinaryName
in classType
- Returns:
- the binary name for this type
-
getSimpleName
public String getSimpleName()
Description copied from class:Type
Returns the name of this type without type arguments or package qualifiers. Forjava.util.List<T>
, returns"List"
.- Specified by:
getSimpleName
in classType
- Returns:
- the name of this type without type arguments
-
getReflectionTypeVariable
TypeVariable<?> getReflectionTypeVariable()
-
isGeneric
public boolean isGeneric(boolean ignoreWildcards)
Description copied from class:Type
Indicate whether this type is generic. A type is generic if it has one or more type variables.
-
substitute
public ReferenceType substitute(Substitution substitution)
Description copied from class:ReferenceType
Applies a substitution to aReferenceType
. If the type is parameterized then replaces type variables that occur, otherwise returns this type.This abstract method forces typing of substitutions applied to
ReferenceType
objects without an explicit cast.- Overrides:
substitute
in classTypeVariable
- Parameters:
substitution
- the type substitution- Returns:
- the type created by applying the substitution to this type
-
createCopyWithBounds
public TypeVariable createCopyWithBounds(ParameterBound lowerBound, ParameterBound upperBound)
- Specified by:
createCopyWithBounds
in classTypeVariable
-
-