Package randoop.types
Class LazyReferenceBound
- java.lang.Object
-
- randoop.types.ParameterBound
-
- randoop.types.ReferenceBound
-
- randoop.types.LazyReferenceBound
-
class LazyReferenceBound extends ReferenceBound
A lazy representation of a type bound in which a type variable occurs. Similar in purpose toLazyParameterBound
, but this class usesReferenceType
as the bound instead ofjava.lang.reflect.Type
. Also, prevents access to recursive type bounds, that would otherwise result in nonterminating calls togetTypeParameters()
.Objects of this class are created by
LazyParameterBound.substitute(Substitution)
when the substitution would replace a type variable with another type variable.
-
-
Constructor Summary
Constructors Constructor Description LazyReferenceBound(ReferenceType boundType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ReferenceBound
applyCaptureConversion()
Applies a capture conversion to any wildcard arguments in the type of this bound.List<TypeVariable>
getTypeParameters()
Returns any type parameters in the type of this bound.int
hashCode()
boolean
isLowerBound(Type argType, Substitution substitution)
Indicates whether this bound is a lower bound of the given argument type.boolean
isSubtypeOf(ParameterBound boundType)
Indicates whether the type of this bound is a subtype of the type of the given bound.(package private) boolean
isUpperBound(ParameterBound bound, Substitution substitution)
Indicates whether this bound is an upper bound on the type of the given bound with respect to the type substitution.boolean
isUpperBound(Type argType, Substitution substitution)
Determines if this bound is an upper bound for the argument type.ReferenceBound
substitute(Substitution substitution)
Applies the given substitution to this type bound by replacing type variables.-
Methods inherited from class randoop.types.ReferenceBound
equals, getBoundType, hasCaptureVariable, hasWildcard, isGeneric, isObject, isVariable, toString
-
Methods inherited from class randoop.types.ParameterBound
forType, forType, forTypes, isGeneric, isLowerBound, isTypeVariable
-
-
-
-
Constructor Detail
-
LazyReferenceBound
LazyReferenceBound(ReferenceType boundType)
-
-
Method Detail
-
hashCode
public int hashCode()
LazyReferenceBound
can be part of a recursive type, and so the hash code is based on the string representation of the bound to avoid recursive calls onhashCode()
.- Overrides:
hashCode
in classReferenceBound
- Returns:
- the hashCode for the string representation of this bound
-
substitute
public ReferenceBound substitute(Substitution substitution)
Description copied from class:ParameterBound
Applies the given substitution to this type bound by replacing type variables.- Specified by:
substitute
in classReferenceBound
- Parameters:
substitution
- the type substitution- Returns:
- this bound with the type after the substitution has been applied
-
applyCaptureConversion
public ReferenceBound applyCaptureConversion()
Description copied from class:ParameterBound
Applies a capture conversion to any wildcard arguments in the type of this bound.- Specified by:
applyCaptureConversion
in classReferenceBound
- Returns:
- this type with any wildcards replaced by capture conversion
- See Also:
ReferenceType.applyCaptureConversion()
-
getTypeParameters
public List<TypeVariable> getTypeParameters()
Description copied from class:ParameterBound
Returns any type parameters in the type of this bound.- Specified by:
getTypeParameters
in classParameterBound
- Returns:
- the list of
TypeVariable
objects in this bound
-
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 classParameterBound
- Parameters:
argType
- the concrete argument typesubstitution
- the substitution- Returns:
- true if this bound is a subtype of the given type
-
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 classParameterBound
- 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)
Description copied from class:ParameterBound
Determines if this bound is an upper bound for the argument type.- Specified by:
isUpperBound
in classParameterBound
- Parameters:
argType
- the concrete argument typesubstitution
- 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 classParameterBound
- Parameters:
bound
- the other boundsubstitution
- the type substitution- Returns:
- true if this bound is an upper bound on the type of the given bound, false otherwise
-
-