Package randoop.types

Class ParameterType

  • All Implemented Interfaces:
    Comparable<Type>
    Direct Known Subclasses:
    TypeVariable, WildcardType

    public abstract class ParameterType
    extends ReferenceType
    An abstract class representing kinds of type parameters, which are either type variables or wildcard types. Manages both upper and lower type bounds.
    • Field Detail

      • lowerBound

        private ParameterBound lowerBound
        The lower bound on this type.
      • upperBound

        private ParameterBound upperBound
        The upper bound on this type.
    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • 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
      • 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.

        Specified by:
        getRuntimeClass in class Type
        Returns:
        null since type variables do not have a runtime class
      • 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
      • hasGenericBound

        public boolean hasGenericBound()
        Return true if this has a generic bound.
        Returns:
        true if this has a generic bound