public class TreeAnnotator extends com.sun.source.util.SimpleTreeVisitor<java.lang.Void,AnnotatedTypeMirror>
ImplicitFor
annotation and applies implicit
annotations specified by ImplicitFor
for any tree whose visitor is
not overridden or does not call super
; it is designed to be invoked
from
AnnotatedTypeFactory.annotateImplicit(Element, AnnotatedTypeMirror)
and AnnotatedTypeFactory.annotateImplicit(Tree, AnnotatedTypeMirror)
.
TreeAnnotator
does not traverse trees deeply by default.
This class takes care of three of the attributes of ImplicitFor
;
the others are handled in TypeAnnotator
.
TODO: we currently don't check that any attribute is set, that is, a qualifier
could be annotated as @ImplicitFor(), which might be misleading.
TypeAnnotator
Modifier and Type | Field and Description |
---|---|
protected AnnotatedTypeFactory |
atypeFactory |
Constructor and Description |
---|
TreeAnnotator(AnnotatedTypeFactory atypeFactory)
Creates a
TypeAnnotator from the given checker, using that checker's
TypeQualifiers annotation to determine the annotations that are
in the type hierarchy. |
Modifier and Type | Method and Description |
---|---|
void |
addStringPattern(java.lang.String pattern,
javax.lang.model.element.AnnotationMirror theQual) |
void |
addTreeClass(java.lang.Class<? extends com.sun.source.tree.Tree> treeClass,
javax.lang.model.element.AnnotationMirror theQual) |
void |
addTreeKind(com.sun.source.tree.Tree.Kind treeKind,
javax.lang.model.element.AnnotationMirror theQual) |
java.lang.Void |
defaultAction(com.sun.source.tree.Tree tree,
AnnotatedTypeMirror type) |
java.lang.Void |
visitBinary(com.sun.source.tree.BinaryTree node,
AnnotatedTypeMirror type) |
java.lang.Void |
visitCompoundAssignment(com.sun.source.tree.CompoundAssignmentTree node,
AnnotatedTypeMirror type) |
java.lang.Void |
visitLiteral(com.sun.source.tree.LiteralTree tree,
AnnotatedTypeMirror type)
Go through the string patterns and add the greatest lower bound of all matching patterns.
|
java.lang.Void |
visitNewArray(com.sun.source.tree.NewArrayTree tree,
AnnotatedTypeMirror type) |
java.lang.Void |
visitTypeCast(com.sun.source.tree.TypeCastTree node,
AnnotatedTypeMirror type) |
java.lang.Void |
visitUnary(com.sun.source.tree.UnaryTree node,
AnnotatedTypeMirror type) |
visit, visit, visitAnnotatedType, visitAnnotation, visitArrayAccess, visitArrayType, visitAssert, visitAssignment, visitBlock, visitBreak, visitCase, visitCatch, visitClass, visitCompilationUnit, visitConditionalExpression, visitContinue, visitDoWhileLoop, visitEmptyStatement, visitEnhancedForLoop, visitErroneous, visitExpressionStatement, visitForLoop, visitIdentifier, visitIf, visitImport, visitInstanceOf, visitIntersectionType, visitLabeledStatement, visitLambdaExpression, visitMemberReference, visitMemberSelect, visitMethod, visitMethodInvocation, visitModifiers, visitNewClass, visitOther, visitParameterizedType, visitParenthesized, visitPrimitiveType, visitReturn, visitSwitch, visitSynchronized, visitThrow, visitTry, visitTypeParameter, visitUnionType, visitVariable, visitWhileLoop, visitWildcard
protected final AnnotatedTypeFactory atypeFactory
public TreeAnnotator(AnnotatedTypeFactory atypeFactory)
TypeAnnotator
from the given checker, using that checker's
TypeQualifiers
annotation to determine the annotations that are
in the type hierarchy.public void addTreeClass(java.lang.Class<? extends com.sun.source.tree.Tree> treeClass, javax.lang.model.element.AnnotationMirror theQual)
public void addTreeKind(com.sun.source.tree.Tree.Kind treeKind, javax.lang.model.element.AnnotationMirror theQual)
public void addStringPattern(java.lang.String pattern, javax.lang.model.element.AnnotationMirror theQual)
public java.lang.Void defaultAction(com.sun.source.tree.Tree tree, AnnotatedTypeMirror type)
defaultAction
in class com.sun.source.util.SimpleTreeVisitor<java.lang.Void,AnnotatedTypeMirror>
public java.lang.Void visitLiteral(com.sun.source.tree.LiteralTree tree, AnnotatedTypeMirror type)
visitLiteral
in interface com.sun.source.tree.TreeVisitor<java.lang.Void,AnnotatedTypeMirror>
visitLiteral
in class com.sun.source.util.SimpleTreeVisitor<java.lang.Void,AnnotatedTypeMirror>
public java.lang.Void visitNewArray(com.sun.source.tree.NewArrayTree tree, AnnotatedTypeMirror type)
visitNewArray
in interface com.sun.source.tree.TreeVisitor<java.lang.Void,AnnotatedTypeMirror>
visitNewArray
in class com.sun.source.util.SimpleTreeVisitor<java.lang.Void,AnnotatedTypeMirror>
public java.lang.Void visitCompoundAssignment(com.sun.source.tree.CompoundAssignmentTree node, AnnotatedTypeMirror type)
visitCompoundAssignment
in interface com.sun.source.tree.TreeVisitor<java.lang.Void,AnnotatedTypeMirror>
visitCompoundAssignment
in class com.sun.source.util.SimpleTreeVisitor<java.lang.Void,AnnotatedTypeMirror>
public java.lang.Void visitBinary(com.sun.source.tree.BinaryTree node, AnnotatedTypeMirror type)
visitBinary
in interface com.sun.source.tree.TreeVisitor<java.lang.Void,AnnotatedTypeMirror>
visitBinary
in class com.sun.source.util.SimpleTreeVisitor<java.lang.Void,AnnotatedTypeMirror>
public java.lang.Void visitUnary(com.sun.source.tree.UnaryTree node, AnnotatedTypeMirror type)
visitUnary
in interface com.sun.source.tree.TreeVisitor<java.lang.Void,AnnotatedTypeMirror>
visitUnary
in class com.sun.source.util.SimpleTreeVisitor<java.lang.Void,AnnotatedTypeMirror>
public java.lang.Void visitTypeCast(com.sun.source.tree.TypeCastTree node, AnnotatedTypeMirror type)
visitTypeCast
in interface com.sun.source.tree.TreeVisitor<java.lang.Void,AnnotatedTypeMirror>
visitTypeCast
in class com.sun.source.util.SimpleTreeVisitor<java.lang.Void,AnnotatedTypeMirror>