public class BaseTypeValidator extends AnnotatedTypeScanner<java.lang.Void,com.sun.source.tree.Tree>
Modifier and Type | Field and Description |
---|---|
protected AnnotatedTypeFactory |
atypeFactory |
protected BaseTypeChecker |
checker |
protected boolean |
isValid |
protected BaseTypeVisitor<?> |
visitor |
visitedNodes
Constructor and Description |
---|
BaseTypeValidator(BaseTypeChecker checker,
BaseTypeVisitor<?> visitor,
AnnotatedTypeFactory atypeFactory) |
Modifier and Type | Method and Description |
---|---|
boolean |
isValid(AnnotatedTypeMirror type,
com.sun.source.tree.Tree tree)
The entry point to the type validator.
|
protected void |
reportError(AnnotatedTypeMirror type,
com.sun.source.tree.Tree p) |
protected void |
reportValidityResult(@CompilerMessageKey java.lang.String errorType,
AnnotatedTypeMirror type,
com.sun.source.tree.Tree p) |
java.lang.Void |
visitArray(AnnotatedTypeMirror.AnnotatedArrayType type,
com.sun.source.tree.Tree tree)
Visits an array type.
|
java.lang.Void |
visitDeclared(AnnotatedTypeMirror.AnnotatedDeclaredType type,
com.sun.source.tree.Tree tree)
Visits a declared type.
|
protected java.lang.Void |
visitParameterizedType(AnnotatedTypeMirror.AnnotatedDeclaredType type,
com.sun.source.tree.ParameterizedTypeTree tree)
Checks that the annotations on the type arguments supplied to a type or a
method invocation are within the bounds of the type variables as
declared, and issues the "type.argument.type.incompatible" error if they are
not.
|
java.lang.Void |
visitPrimitive(AnnotatedTypeMirror.AnnotatedPrimitiveType type,
com.sun.source.tree.Tree tree)
Visits a primitive type.
|
java.lang.Void |
visitTypeVariable(AnnotatedTypeMirror.AnnotatedTypeVariable type,
com.sun.source.tree.Tree tree)
Visits a type variable.
|
java.lang.Void |
visitWildcard(AnnotatedTypeMirror.AnnotatedWildcardType type,
com.sun.source.tree.Tree tree)
Visits a wildcard type.
|
reduce, reset, scan, scan, scanAndReduce, scanAndReduce, visit, visit, visitExecutable, visitIntersection, visitNoType, visitNull, visitUnion
protected boolean isValid
protected final BaseTypeChecker checker
protected final BaseTypeVisitor<?> visitor
protected final AnnotatedTypeFactory atypeFactory
public BaseTypeValidator(BaseTypeChecker checker, BaseTypeVisitor<?> visitor, AnnotatedTypeFactory atypeFactory)
public boolean isValid(AnnotatedTypeMirror type, com.sun.source.tree.Tree tree)
BaseTypeVisitor.validateTypeOf(Tree)
.type
- The type to validate.tree
- The tree from which the type originated.
Note that the tree might be a method tree - the
return type should then be validated.
Note that the tree might be a variable tree - the
field type should then be validated.protected void reportValidityResult(@CompilerMessageKey java.lang.String errorType, AnnotatedTypeMirror type, com.sun.source.tree.Tree p)
protected void reportError(AnnotatedTypeMirror type, com.sun.source.tree.Tree p)
public java.lang.Void visitDeclared(AnnotatedTypeMirror.AnnotatedDeclaredType type, com.sun.source.tree.Tree tree)
AnnotatedTypeVisitor
visitDeclared
in interface AnnotatedTypeVisitor<java.lang.Void,com.sun.source.tree.Tree>
visitDeclared
in class AnnotatedTypeScanner<java.lang.Void,com.sun.source.tree.Tree>
type
- the type to visittree
- a visitor-specified parameterpublic java.lang.Void visitPrimitive(AnnotatedTypeMirror.AnnotatedPrimitiveType type, com.sun.source.tree.Tree tree)
AnnotatedTypeVisitor
visitPrimitive
in interface AnnotatedTypeVisitor<java.lang.Void,com.sun.source.tree.Tree>
visitPrimitive
in class AnnotatedTypeScanner<java.lang.Void,com.sun.source.tree.Tree>
type
- the type to visittree
- a visitor-specified parameterpublic java.lang.Void visitArray(AnnotatedTypeMirror.AnnotatedArrayType type, com.sun.source.tree.Tree tree)
AnnotatedTypeVisitor
visitArray
in interface AnnotatedTypeVisitor<java.lang.Void,com.sun.source.tree.Tree>
visitArray
in class AnnotatedTypeScanner<java.lang.Void,com.sun.source.tree.Tree>
type
- the type to visittree
- a visitor-specified parameterprotected java.lang.Void visitParameterizedType(AnnotatedTypeMirror.AnnotatedDeclaredType type, com.sun.source.tree.ParameterizedTypeTree tree)
public java.lang.Void visitTypeVariable(AnnotatedTypeMirror.AnnotatedTypeVariable type, com.sun.source.tree.Tree tree)
AnnotatedTypeVisitor
visitTypeVariable
in interface AnnotatedTypeVisitor<java.lang.Void,com.sun.source.tree.Tree>
visitTypeVariable
in class AnnotatedTypeScanner<java.lang.Void,com.sun.source.tree.Tree>
type
- the type to visittree
- a visitor-specified parameterpublic java.lang.Void visitWildcard(AnnotatedTypeMirror.AnnotatedWildcardType type, com.sun.source.tree.Tree tree)
AnnotatedTypeVisitor
visitWildcard
in interface AnnotatedTypeVisitor<java.lang.Void,com.sun.source.tree.Tree>
visitWildcard
in class AnnotatedTypeScanner<java.lang.Void,com.sun.source.tree.Tree>
type
- the type to visittree
- a visitor-specified parameter