class IntersectionTypeBound extends ParameterBound
Java requires that an intersection type bound consist of class and interface types, with at most one class, and if there is a class it appears in the conjunction term first. This class preserves the order of the types. In a capture conversion, if both types are classes, one must be a subclass of the other.
Modifier and Type | Field and Description |
---|---|
private java.util.List<ParameterBound> |
boundList
The list of type bounds for the intersection bound.
|
Constructor and Description |
---|
IntersectionTypeBound(java.util.List<ParameterBound> boundList)
Create an intersection type bound from the list of type bounds.
|
Modifier and Type | Method and Description |
---|---|
ParameterBound |
applyCaptureConversion()
Applies a capture conversion to any wildcard arguments in the type of this bound.
|
boolean |
equals(@Nullable java.lang.Object obj) |
java.util.List<TypeVariable> |
getTypeParameters()
Returns any type parameters in the type of this bound.
|
boolean |
hasCaptureVariable()
Indicates whether the type of this bound has a capture variable.
|
int |
hashCode() |
(package private) boolean |
hasWildcard()
Indicates whether the type of this bound has a wildcard type argument.
|
boolean |
isGeneric(boolean ignoreWildcards)
Indicates whether the type of this bound is generic.
|
boolean |
isLowerBound(Type otherType,
Substitution subst)
Indicates whether this bound is a lower bound of the given argument type.
|
boolean |
isObject()
Indicate whether this bound is
Object . |
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 subst)
Determines if this bound is an upper bound for the argument type.
|
IntersectionTypeBound |
substitute(Substitution substitution)
Applies the given substitution to this type bound by replacing type variables.
|
java.lang.String |
toString() |
forType, forType, forTypes, isGeneric, isLowerBound, isTypeVariable, isVariable
private java.util.List<ParameterBound> boundList
IntersectionTypeBound(java.util.List<ParameterBound> boundList)
boundList
- the list of type boundspublic 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.String toString()
toString
in class java.lang.Object
public IntersectionTypeBound substitute(Substitution substitution)
substitute
in class ParameterBound
substitution
- the type substitutionpublic ParameterBound applyCaptureConversion()
applyCaptureConversion
in class ParameterBound
ReferenceType.applyCaptureConversion()
public java.util.List<TypeVariable> getTypeParameters()
getTypeParameters
in class ParameterBound
boolean hasWildcard()
ParameterBound
hasWildcard
in class ParameterBound
public boolean hasCaptureVariable()
ParameterBound
hasCaptureVariable
in class ParameterBound
public boolean isGeneric(boolean ignoreWildcards)
ParameterBound
isGeneric
in class ParameterBound
ignoreWildcards
- if true, ignore wildcards; that is, treat wildcards as not making the
operation genericpublic boolean isLowerBound(Type otherType, Substitution subst)
Specifically, this method checks that the argument type is a subtype of all of the member bounds of this object.
isLowerBound
in class ParameterBound
otherType
- the concrete argument typesubst
- the substitutionpublic boolean isObject()
Object
.
Determines whether all types in this bound are Object
.
isObject
in class ParameterBound
Object
, false otherwisepublic boolean isSubtypeOf(ParameterBound boundType)
This method should never be tested for IntersectionTypeBound
. Will fail if
assertions are enabled.
isSubtypeOf
in class ParameterBound
boundType
- the other boundpublic boolean isUpperBound(Type argType, Substitution subst)
isUpperBound
in class ParameterBound
argType
- the concrete argument typesubst
- the substitutionboolean isUpperBound(ParameterBound bound, Substitution substitution)
isUpperBound
in class ParameterBound
bound
- the other boundsubstitution
- the type substitution