Class TypeResolver.TypeVariableKey

  • Enclosing class:
    TypeResolver

    static final class TypeResolver.TypeVariableKey
    extends java.lang.Object
    Wraps around 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.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.reflect.TypeVariable<?> var  
    • Constructor Summary

      Constructors 
      Constructor Description
      TypeVariableKey​(java.lang.reflect.TypeVariable<?> var)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method 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()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • var

        private final java.lang.reflect.TypeVariable<?> var
    • Constructor Detail

      • TypeVariableKey

        TypeVariableKey​(java.lang.reflect.TypeVariable<?> var)
    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • forLookup

        static TypeResolver.TypeVariableKey forLookup​(java.lang.reflect.Type t)
        Wraps t in a TypeVariableKey if it's a type variable.
      • equalsType

        boolean equalsType​(java.lang.reflect.Type type)
        Returns true if type is a TypeVariable with the same name and declared by the same GenericDeclaration.
      • equalsTypeVariable

        private boolean equalsTypeVariable​(java.lang.reflect.TypeVariable<?> that)