class NullReferenceType extends ReferenceType
null
type is the type of the value null
. As the subtype of all reference
types, it is the default lowerbound of a CaptureTypeVariable
.Modifier and Type | Field and Description |
---|---|
private static NullReferenceType |
value |
Modifier | Constructor and Description |
---|---|
private |
NullReferenceType() |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(@Nullable java.lang.Object obj) |
java.lang.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).
|
java.lang.String |
getCanonicalName()
Returns the name of this type as the "canonical name" of the underlying runtime class.
|
java.lang.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.
|
java.lang.Class<?> |
getRuntimeClass()
Returns the runtime
Class object for this type. |
java.lang.String |
getSimpleName()
Returns the name of this type without type arguments or package qualifiers.
|
boolean |
hasCaptureVariable()
Indicates whether this
ReferenceType 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 a
ReferenceType . |
applyCaptureConversion, forClass, forType, getInstantiatingSubstitution, getInstantiatingSubstitutionforTypeVariable, getTypeParameters, isAssignableFrom, isCaptureVariable, isInstantiationOf, isReferenceType
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
private static final NullReferenceType value
static NullReferenceType getNullType()
public boolean equals(@Nullable java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.Class<?> getRuntimeClass()
Class
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 the Class<?>
for the Type
object, and not of the represented
type. For instance, if a Type
object t
represented the Java type int
,
then t.getRuntimeClass()
would return int.class
while t.getClass()
would return Type.class
.
This method returns null since the NullReferenceType
does not have a runtime
representation
getRuntimeClass
in class Type
Class
that is the runtime representation of the type, or null if this type
is a type variable or null reference typepublic ReferenceType substitute(Substitution substitution)
ReferenceType
ReferenceType
. 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.
substitute
in class ReferenceType
substitution
- the type substitutionpublic java.lang.String getFqName()
Type
java.util.List<T>
return "java.util.List<T>"
.public java.lang.String getBinaryName()
Type
java.util.List<T>
return "java.util.List<T>"
.getBinaryName
in class Type
public java.lang.String getSimpleName()
Type
java.util.List<T>
, returns "List"
.getSimpleName
in class Type
public java.lang.String getCanonicalName()
Type
Type.getFqName()
except for types with type arguments. For java.util.List<T>
returns "java.util.List"
. Returns null
when Class<?>.getCanonicalName()
does for the underlying Class<?>
object (e.g., the type is
a local or anonymous class, or array type where the component type that has no canonical name).getCanonicalName
in class Type
public boolean hasWildcard()
Type
hasWildcard
in class Type
public boolean hasCaptureVariable()
Type
ReferenceType
has a capture variable.hasCaptureVariable
in class Type
public boolean isSubtypeOf(Type otherType)
ReferenceType
For ReferenceType
, returns true if otherType
is Object
.
isSubtypeOf
in class ReferenceType
otherType
- the possible supertype