Class Overrides.ExplicitOverrides.TypeSubstVisitor

  • All Implemented Interfaces:
    javax.lang.model.type.TypeVisitor<javax.lang.model.type.TypeMirror,​java.lang.Void>
    Enclosing class:
    Overrides.ExplicitOverrides

    private class Overrides.ExplicitOverrides.TypeSubstVisitor
    extends javax.lang.model.util.SimpleTypeVisitor8<javax.lang.model.type.TypeMirror,​java.lang.Void>
    Visitor that replaces type variables with their values in the types it sees. If we know that E is String, then we can return String for E, List<String> for List<E>, String[] for E[], etc. We don't have to cover all types here because (1) the type is going to end up being erased, and (2) wildcards can't appear in direct supertypes. So for example it is illegal to write class MyList implements List<? extends Number>. It's legal to write class MyList implements List<Set<? extends Number>> but that doesn't matter because the E of the List is going to be erased to raw Set.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Map<javax.lang.model.element.TypeParameterElement,​javax.lang.model.type.TypeMirror> typeBindings
      The bindings of type variables.
      • Fields inherited from class javax.lang.model.util.SimpleTypeVisitor6

        DEFAULT_VALUE
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private TypeSubstVisitor()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected javax.lang.model.type.TypeMirror defaultAction​(javax.lang.model.type.TypeMirror e, java.lang.Void p)  
      (package private) com.google.common.collect.ImmutableList<javax.lang.model.type.TypeMirror> erasedParameterTypes​(javax.lang.model.element.ExecutableElement method, javax.lang.model.element.TypeElement in)  
      javax.lang.model.type.TypeMirror visitArray​(javax.lang.model.type.ArrayType t, java.lang.Void p)  
      javax.lang.model.type.TypeMirror visitDeclared​(javax.lang.model.type.DeclaredType t, java.lang.Void p)  
      javax.lang.model.type.TypeMirror visitTypeVariable​(javax.lang.model.type.TypeVariable t, java.lang.Void p)  
      • Methods inherited from class javax.lang.model.util.SimpleTypeVisitor8

        visitIntersection
      • Methods inherited from class javax.lang.model.util.SimpleTypeVisitor7

        visitUnion
      • Methods inherited from class javax.lang.model.util.SimpleTypeVisitor6

        visitError, visitExecutable, visitNoType, visitNull, visitPrimitive, visitWildcard
      • Methods inherited from class javax.lang.model.util.AbstractTypeVisitor6

        visit, visit, visitUnknown
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • typeBindings

        private final java.util.Map<javax.lang.model.element.TypeParameterElement,​javax.lang.model.type.TypeMirror> typeBindings
        The bindings of type variables. We can put them all in one map because E in List<E> is not the same as E in Collection<E>. As we ascend the type hierarchy we'll add mappings for all the variables we see. We could equivalently create a new map for each type we visit, but this is slightly simpler and probably about as performant.
    • Constructor Detail

      • TypeSubstVisitor

        private TypeSubstVisitor()
    • Method Detail

      • erasedParameterTypes

        com.google.common.collect.ImmutableList<javax.lang.model.type.TypeMirror> erasedParameterTypes​(javax.lang.model.element.ExecutableElement method,
                                                                                                       javax.lang.model.element.TypeElement in)
      • defaultAction

        protected javax.lang.model.type.TypeMirror defaultAction​(javax.lang.model.type.TypeMirror e,
                                                                 java.lang.Void p)
        Overrides:
        defaultAction in class javax.lang.model.util.SimpleTypeVisitor6<javax.lang.model.type.TypeMirror,​java.lang.Void>
      • visitTypeVariable

        public javax.lang.model.type.TypeMirror visitTypeVariable​(javax.lang.model.type.TypeVariable t,
                                                                  java.lang.Void p)
        Specified by:
        visitTypeVariable in interface javax.lang.model.type.TypeVisitor<javax.lang.model.type.TypeMirror,​java.lang.Void>
        Overrides:
        visitTypeVariable in class javax.lang.model.util.SimpleTypeVisitor6<javax.lang.model.type.TypeMirror,​java.lang.Void>
      • visitDeclared

        public javax.lang.model.type.TypeMirror visitDeclared​(javax.lang.model.type.DeclaredType t,
                                                              java.lang.Void p)
        Specified by:
        visitDeclared in interface javax.lang.model.type.TypeVisitor<javax.lang.model.type.TypeMirror,​java.lang.Void>
        Overrides:
        visitDeclared in class javax.lang.model.util.SimpleTypeVisitor6<javax.lang.model.type.TypeMirror,​java.lang.Void>
      • visitArray

        public javax.lang.model.type.TypeMirror visitArray​(javax.lang.model.type.ArrayType t,
                                                           java.lang.Void p)
        Specified by:
        visitArray in interface javax.lang.model.type.TypeVisitor<javax.lang.model.type.TypeMirror,​java.lang.Void>
        Overrides:
        visitArray in class javax.lang.model.util.SimpleTypeVisitor6<javax.lang.model.type.TypeMirror,​java.lang.Void>