Package randoop.types

Class LazyParameterBound


  • class LazyParameterBound
    extends ParameterBound
    A lazy representation of a type bound in which a type variable occurs. Prevents type recognition from having to deal with recursive type bounds. All methods that need to evaluate the bound are provided with a substitution for the variable for which this object is a bound.
    • Field Detail

      • boundType

        private final Type boundType
        The type for this bound.
    • Constructor Detail

      • LazyParameterBound

        LazyParameterBound​(Type boundType)
        Creates a LazyParameterBound from the given rawtype and type parameters.
        Parameters:
        boundType - the reflection type for this bound
    • Method Detail

      • equals

        public boolean equals​(Object obj)
        Overrides:
        equals in class Object
        Returns:
        true if argument is a LazyParameterBound, and the rawtype and parameters are identical, false otherwise
      • hashCode

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

        public ParameterBound substitute​(Substitution substitution)
        Description copied from class: ParameterBound
        Applies the given substitution to this type bound by replacing type variables.
        Specified by:
        substitute in class ParameterBound
        Parameters:
        substitution - the type substitution
        Returns:
        this bound with the type after the substitution has been applied
      • substitute

        private static TypeArgument substitute​(Type type,
                                               Substitution substitution)
        Applies a substitution to a reflection type that occurs as an actual argument of a parameterized type bound, to create a type argument to a ParameterizedType.
        Parameters:
        type - the reflection type
        substitution - the type substitution
        Returns:
        the type argument
      • getTypeParameters

        private static List<TypeVariable> getTypeParameters​(Type type)
        Collects the type parameters from the given reflection Type object.
        Parameters:
        type - the Type reference
        Returns:
        the list of type variables in the given type
      • hasWildcard

        boolean hasWildcard()
        Description copied from class: ParameterBound
        Indicates whether the type of this bound has a wildcard type argument.
        Specified by:
        hasWildcard in class ParameterBound
        Returns:
        true, if this bound has a wildcard argument, and false otherwise
      • hasWildcard

        private static boolean hasWildcard​(Type type)
      • hasCaptureVariable

        public boolean hasCaptureVariable()
        Description copied from class: ParameterBound
        Indicates whether the type of this bound has a capture variable.
        Specified by:
        hasCaptureVariable in class ParameterBound
        Returns:
        true iff this bound has a capture variable
      • hasCaptureVariable

        private static boolean hasCaptureVariable​(Type type)
        Return true if the given type has a capture variable.
        Parameters:
        type - the type to test
        Returns:
        true if the given type has a capture variable
      • isGeneric

        public boolean isGeneric​(boolean ignoreWildcards)
        Description copied from class: ParameterBound
        Indicates whether the type of this bound is generic.
        Specified by:
        isGeneric in class ParameterBound
        Parameters:
        ignoreWildcards - if true, ignore wildcards; that is, treat wildcards as not making the operation generic
        Returns:
        true, if this bound type is generic, and false otherwise
      • isLowerBound

        public boolean isLowerBound​(Type argType,
                                    Substitution substitution)
        Description copied from class: ParameterBound
        Indicates whether this bound is a lower bound of the given argument type.
        Specified by:
        isLowerBound in class ParameterBound
        Parameters:
        argType - the concrete argument type
        substitution - the substitution
        Returns:
        true if this bound is a subtype of the given type
      • isObject

        public boolean isObject()
        Description copied from class: ParameterBound
        Indicate whether this bound is Object.
        Specified by:
        isObject in class ParameterBound
        Returns:
        true if this bound is Object, false otherwise
      • isSubtypeOf

        public boolean isSubtypeOf​(ParameterBound boundType)
        Description copied from class: ParameterBound
        Indicates whether the type of this bound is a subtype of the type of the given bound.
        Specified by:
        isSubtypeOf in class ParameterBound
        Parameters:
        boundType - the other bound
        Returns:
        true if this type is a subtype of the other bound, false otherwise
      • isUpperBound

        public boolean isUpperBound​(Type argType,
                                    Substitution substitution)
        Determines if this bound is an upper bound for the argument type.

        This generic type bound is satisfied by a concrete type if the concrete type formed by applying the substitution to this generic bound is satisfied by the concrete type.

        Specified by:
        isUpperBound in class ParameterBound
        Parameters:
        argType - the concrete argument type
        substitution - the substitution
        Returns:
        true if this bound is satisfied by the concrete type when the substitution is used on the bound, false otherwise
      • isUpperBound

        boolean isUpperBound​(ParameterBound bound,
                             Substitution substitution)
        Description copied from class: ParameterBound
        Indicates whether this bound is an upper bound on the type of the given bound with respect to the type substitution.
        Specified by:
        isUpperBound in class ParameterBound
        Parameters:
        bound - the other bound
        substitution - the type substitution
        Returns:
        true if this bound is an upper bound on the type of the given bound, false otherwise
      • isVariable

        public boolean isVariable()
        Description copied from class: ParameterBound
        Indicates whether this bound is a type variable.
        Overrides:
        isVariable in class ParameterBound
        Returns:
        true if this bound is a type variable, false otherwise