Package com.google.auto.common
Class Overrides.ExplicitOverrides.TypeSubstVisitor
java.lang.Object
javax.lang.model.util.AbstractTypeVisitor6<TypeMirror,Void>
javax.lang.model.util.SimpleTypeVisitor6<TypeMirror,Void>
javax.lang.model.util.SimpleTypeVisitor7<TypeMirror,Void>
javax.lang.model.util.SimpleTypeVisitor8<TypeMirror,Void>
com.google.auto.common.Overrides.ExplicitOverrides.TypeSubstVisitor
- All Implemented Interfaces:
TypeVisitor<TypeMirror,Void>
- Enclosing class:
Overrides.ExplicitOverrides
private class Overrides.ExplicitOverrides.TypeSubstVisitor
extends SimpleTypeVisitor8<TypeMirror,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
FieldsModifier and TypeFieldDescriptionprivate final Map<TypeParameterElement, TypeMirror> The bindings of type variables.Fields inherited from class javax.lang.model.util.SimpleTypeVisitor6
DEFAULT_VALUE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected TypeMirrordefaultAction(TypeMirror e, Void p) (package private) com.google.common.collect.ImmutableList<TypeMirror> erasedParameterTypes(ExecutableElement method, TypeElement in) visitArray(ArrayType t, Void p) visitDeclared(DeclaredType t, Void p) Methods inherited from class javax.lang.model.util.SimpleTypeVisitor8
visitIntersectionMethods inherited from class javax.lang.model.util.SimpleTypeVisitor7
visitUnionMethods inherited from class javax.lang.model.util.SimpleTypeVisitor6
visitError, visitExecutable, visitNoType, visitNull, visitPrimitive, visitWildcardMethods inherited from class javax.lang.model.util.AbstractTypeVisitor6
visit, visit, visitUnknown
-
Field Details
-
typeBindings
The bindings of type variables. We can put them all in one map because E inList<E>is not the same as E inCollection<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 Details
-
TypeSubstVisitor
private TypeSubstVisitor()
-
-
Method Details
-
erasedParameterTypes
com.google.common.collect.ImmutableList<TypeMirror> erasedParameterTypes(ExecutableElement method, TypeElement in) -
defaultAction
- Overrides:
defaultActionin classSimpleTypeVisitor6<TypeMirror,Void>
-
visitTypeVariable
- Specified by:
visitTypeVariablein interfaceTypeVisitor<TypeMirror,Void> - Overrides:
visitTypeVariablein classSimpleTypeVisitor6<TypeMirror,Void>
-
visitDeclared
- Specified by:
visitDeclaredin interfaceTypeVisitor<TypeMirror,Void> - Overrides:
visitDeclaredin classSimpleTypeVisitor6<TypeMirror,Void>
-
visitArray
- Specified by:
visitArrayin interfaceTypeVisitor<TypeMirror,Void> - Overrides:
visitArrayin classSimpleTypeVisitor6<TypeMirror,Void>
-