Package randoop.types
Class NullReferenceType
- java.lang.Object
-
- randoop.types.Type
-
- randoop.types.ReferenceType
-
- randoop.types.NullReferenceType
-
- All Implemented Interfaces:
Comparable<Type>
class NullReferenceType extends ReferenceType
Thenull
type is the type of the valuenull
. As the subtype of all reference types, it is the default lowerbound of aCaptureTypeVariable
.
-
-
Field Summary
Fields Modifier and Type Field Description private static NullReferenceType
value
-
Constructor Summary
Constructors Modifier Constructor Description private
NullReferenceType()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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
getCanonicalName()
Returns the name of this type as the "canonical name" of the underlying runtime class.String
getFqName()
Returns the fully-qualified name of this type, including type arguments if this is a parameterized type.(package private) static NullReferenceType
getNullType()
Returns the null type.Class<?>
getRuntimeClass()
Returns the runtimeClass
object for this type.String
getSimpleName()
Returns the name of this type without type arguments or package qualifiers.boolean
hasCaptureVariable()
Indicates whether thisReferenceType
has a capture variable.int
hashCode()
boolean
hasWildcard()
Indicates whether this type has a wildcard anywhere within it.boolean
isSubtypeOf(Type otherType)
Test whether this type is a subtype of the given type according to transitive closure of definition of the direct supertype relation in section 4.10 of JLS for Java SE 8.ReferenceType
substitute(Substitution substitution)
Applies a substitution to aReferenceType
.-
Methods inherited from class randoop.types.ReferenceType
applyCaptureConversion, forClass, forType, getInstantiatingSubstitution, getInstantiatingSubstitutionforTypeVariable, getTypeParameters, isAssignableFrom, isCaptureVariable, isInstantiationOf, isReferenceType
-
Methods inherited from class randoop.types.Type
compareTo, forFullyQualifiedName, forName, forValue, getRawtype, getTypeforFullyQualifiedName, getUnqualifiedBinaryName, isArray, isAssignableFromTypeOf, isBoxedPrimitive, isClass, isClassOrInterfaceType, isEnum, isGeneric, isGeneric, isInterface, isNonreceiverType, isObject, isParameterized, isPrimitive, isRawtype, isString, isVariable, isVoid, runtimeClassIs, toString
-
-
-
-
Field Detail
-
value
private static final NullReferenceType value
-
-
Method Detail
-
getNullType
static NullReferenceType getNullType()
Returns the null type.- Returns:
- the null type object
-
getRuntimeClass
public Class<?> getRuntimeClass()
Returns the runtimeClass
object for this type. For use when reflection is needed.Note that type variables and the null reference type do not have a runtime class, and this method will return null in those cases.
This method should not be confused with the inherited
Object.getClass()
method, which returns theClass<?>
for theType
object, and not of the represented type. For instance, if aType
objectt
represented the Java typeint
, thent.getRuntimeClass()
would returnint.class
whilet.getClass()
would returnType.class
.This method returns null since the
NullReferenceType
does not have a runtime representation- Specified by:
getRuntimeClass
in classType
- Returns:
- the
Class
that is the runtime representation of the type, or null if this type is a type variable or null reference type
-
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.- Specified by:
substitute
in classReferenceType
- Parameters:
substitution
- the type substitution- Returns:
- the type created by applying the substitution to this type
-
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
-
getCanonicalName
public String getCanonicalName()
Description copied from class:Type
Returns the name of this type as the "canonical name" of the underlying runtime class. Identical toType.getFqName()
except for types with type arguments. Forjava.util.List<T>
returns"java.util.List"
. Returnsnull
whenClass<?>.getCanonicalName()
does for the underlyingClass<?>
object (e.g., the type is a local or anonymous class, or array type where the component type that has no canonical name).- Overrides:
getCanonicalName
in classType
- Returns:
- the fully-qualified canonical name of this type
-
hasWildcard
public boolean hasWildcard()
Description copied from class:Type
Indicates whether this type has a wildcard anywhere within it.- Overrides:
hasWildcard
in classType
- Returns:
- true if this type has a wildcard, false otherwise
-
hasCaptureVariable
public boolean hasCaptureVariable()
Description copied from class:Type
Indicates whether thisReferenceType
has a capture variable.- Overrides:
hasCaptureVariable
in classType
- Returns:
- true iff this type has a capture variable
-
isSubtypeOf
public boolean isSubtypeOf(Type otherType)
Description copied from class:ReferenceType
Test whether this type is a subtype of the given type according to transitive closure of definition of the direct supertype relation in section 4.10 of JLS for Java SE 8.For
ReferenceType
, returns true ifotherType
isObject
.- Overrides:
isSubtypeOf
in classReferenceType
- Parameters:
otherType
- the possible supertype- Returns:
- true if this type is a subtype of the given type, false otherwise
-
-