public abstract class TreeAnnotator extends SimpleTreeVisitor<Void,AnnotatedTypeMirror>
TreeAnnotator is an abstract SimpleTreeVisitor to be used with ListTreeAnnotator.
This class does not visit component parts of the tree. By default, the visit methods all call
SimpleTreeVisitor.defaultAction(Tree, Object), which does nothing unless overriden. Therefore, subclass do
not need to call super unless they override SimpleTreeVisitor.defaultAction(Tree, Object).
| Modifier and Type | Field and Description |
|---|---|
protected AnnotatedTypeFactory |
atypeFactory |
DEFAULT_VALUE| Modifier | Constructor and Description |
|---|---|
protected |
TreeAnnotator(AnnotatedTypeFactory atypeFactory) |
| Modifier and Type | Method and Description |
|---|---|
Void |
visitBinary(BinaryTree node,
AnnotatedTypeMirror mirror)
When overriding this method, getAnnotatedType on the left and right operands should only be
called when absolutely necessary.
|
Void |
visitMethod(MethodTree node,
AnnotatedTypeMirror p)
This method is not called when checking a method invocation against its declaration.
|
defaultAction, visit, visit, visitAnnotatedType, visitAnnotation, visitArrayAccess, visitArrayType, visitAssert, visitAssignment, visitBlock, visitBreak, visitCase, visitCatch, visitClass, visitCompilationUnit, visitCompoundAssignment, visitConditionalExpression, visitContinue, visitDoWhileLoop, visitEmptyStatement, visitEnhancedForLoop, visitErroneous, visitExports, visitExpressionStatement, visitForLoop, visitIdentifier, visitIf, visitImport, visitInstanceOf, visitIntersectionType, visitLabeledStatement, visitLambdaExpression, visitLiteral, visitMemberReference, visitMemberSelect, visitMethodInvocation, visitModifiers, visitModule, visitNewArray, visitNewClass, visitOpens, visitOther, visitPackage, visitParameterizedType, visitParenthesized, visitPrimitiveType, visitProvides, visitRequires, visitReturn, visitSwitch, visitSynchronized, visitThrow, visitTry, visitTypeCast, visitTypeParameter, visitUnary, visitUnionType, visitUses, visitVariable, visitWhileLoop, visitWildcardprotected final AnnotatedTypeFactory atypeFactory
protected TreeAnnotator(AnnotatedTypeFactory atypeFactory)
public Void visitMethod(MethodTree node, AnnotatedTypeMirror p)
visitMethod in interface TreeVisitor<Void,AnnotatedTypeMirror>visitMethod in class SimpleTreeVisitor<Void,AnnotatedTypeMirror>TypeAnnotatorpublic Void visitBinary(BinaryTree node, AnnotatedTypeMirror mirror)
If a checker's performance is still too slow, the types of binary trees could be computed in
a subclass of CFTransfer. When computing the types
in a transfer, look up the value in the store rather than the AnnotatedTypeFactory. Then this
method should annotate binary trees with top so that the type applied in the transfer is always
a subtype of the type the AnnotatedTypeFactory computes.
visitBinary in interface TreeVisitor<Void,AnnotatedTypeMirror>visitBinary in class SimpleTreeVisitor<Void,AnnotatedTypeMirror>