Package randoop.types

Class NullReferenceType

  • All Implemented Interfaces:
    Comparable<Type>

    class NullReferenceType
    extends ReferenceType
    The null type is the type of the value null. As the subtype of all reference types, it is the default lowerbound of a CaptureTypeVariable.
    • Constructor Detail

      • NullReferenceType

        private NullReferenceType()
    • Method Detail

      • getNullType

        static NullReferenceType getNullType()
        Returns the null type.
        Returns:
        the null type object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • getRuntimeClass

        public Class<?> getRuntimeClass()
        Returns the runtime 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

        Specified by:
        getRuntimeClass in class Type
        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 a 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.

        Specified by:
        substitute in class ReferenceType
        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. For java.util.List<T> return "java.util.List<T>".
        Specified by:
        getFqName in class Type
        Returns:
        the fully-qualified type name for this type
      • 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). For java.util.List<T> return "java.util.List<T>".
        Specified by:
        getBinaryName in class Type
        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. For java.util.List<T>, returns "List".
        Specified by:
        getSimpleName in class Type
        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 to 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).
        Overrides:
        getCanonicalName in class Type
        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 class Type
        Returns:
        true if this type has a wildcard, false otherwise
      • hasCaptureVariable

        public boolean hasCaptureVariable()
        Description copied from class: Type
        Indicates whether this ReferenceType has a capture variable.
        Overrides:
        hasCaptureVariable in class Type
        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 if otherType is Object.

        Overrides:
        isSubtypeOf in class ReferenceType
        Parameters:
        otherType - the possible supertype
        Returns:
        true if this type is a subtype of the given type, false otherwise