static final class TypeResolver.TypeVariableKey
extends java.lang.Object
TypeVariable<?>
to ensure that any two type variables are equal as long as
they are declared by the same GenericDeclaration
and have the same
name, even if their bounds differ.
While resolving a type variable from a var -> type
map, we don't care whether the
type variable's bound has been partially resolved. As long as the type variable "identity"
matches.
On the other hand, if for example we are resolving List<A extends B>
to List<A extends String>
, we need to compare that <A extends B>
is unequal to <A
extends String>
in order to decide to use the transformed type instead of the original type.
Modifier and Type | Field and Description |
---|---|
private java.lang.reflect.TypeVariable<?> |
var |
Constructor and Description |
---|
TypeVariableKey(java.lang.reflect.TypeVariable<?> var) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
(package private) boolean |
equalsType(java.lang.reflect.Type type)
Returns true if
type is a TypeVariable with the same name and declared by the
same GenericDeclaration . |
private boolean |
equalsTypeVariable(java.lang.reflect.TypeVariable<?> that) |
(package private) static TypeResolver.TypeVariableKey |
forLookup(java.lang.reflect.Type t)
Wraps
t in a TypeVariableKey if it's a type variable. |
int |
hashCode() |
java.lang.String |
toString() |
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
static TypeResolver.TypeVariableKey forLookup(java.lang.reflect.Type t)
t
in a TypeVariableKey
if it's a type variable.boolean equalsType(java.lang.reflect.Type type)
type
is a TypeVariable
with the same name and declared by the
same GenericDeclaration
.private boolean equalsTypeVariable(java.lang.reflect.TypeVariable<?> that)