Class TreeAnnotator

  extended by com.sun.source.util.SimpleTreeVisitor<Void,AnnotatedTypeMirror>
      extended by checkers.types.TreeAnnotator
All Implemented Interfaces:

public class TreeAnnotator
extends SimpleTreeVisitor<Void,AnnotatedTypeMirror>

Adds annotations to a type based on the contents of a tree. By default, this class honors the 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.

Field Summary
Modifier and Type Field and Description
Fields inherited from class com.sun.source.util.SimpleTreeVisitor
Constructor Summary
Constructor and Description
TreeAnnotator(BaseTypeChecker checker)
          Creates a TypeAnnotator from the given checker, using that checker's TypeQualifiers annotation to determine the annotations that are in the type hierarchy.
Method Summary
Modifier and Type Method and Description
 Void defaultAction(Tree tree, AnnotatedTypeMirror type)
 Void visitLiteral(LiteralTree tree, AnnotatedTypeMirror type)
Methods inherited from class com.sun.source.util.SimpleTreeVisitor
visit, visit, visitAnnotatedType, visitAnnotation, visitArrayAccess, visitArrayType, visitAssert, visitAssignment, visitBinary, visitBlock, visitBreak, visitCase, visitCatch, visitClass, visitCompilationUnit, visitCompoundAssignment, visitConditionalExpression, visitContinue, visitDoWhileLoop, visitEmptyStatement, visitEnhancedForLoop, visitErroneous, visitExpressionStatement, visitForLoop, visitIdentifier, visitIf, visitImport, visitInstanceOf, visitLabeledStatement, visitMemberSelect, visitMethod, visitMethodInvocation, visitModifiers, visitNewArray, visitNewClass, visitOther, visitParameterizedType, visitParenthesized, visitPrimitiveType, visitReturn, visitSwitch, visitSynchronized, visitThrow, visitTry, visitTypeCast, visitTypeParameter, visitUnary, visitVariable, visitWhileLoop, visitWildcard
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public TreeAnnotator(BaseTypeChecker checker)
Creates a TypeAnnotator from the given checker, using that checker's TypeQualifiers annotation to determine the annotations that are in the type hierarchy.

checker - the type checker to which this annotator belongs
Method Detail


public Void defaultAction(Tree tree,
                          AnnotatedTypeMirror type)
defaultAction in class SimpleTreeVisitor<Void,AnnotatedTypeMirror>


public Void visitLiteral(LiteralTree tree,
                         AnnotatedTypeMirror type)
Specified by:
visitLiteral in interface TreeVisitor<Void,AnnotatedTypeMirror>
visitLiteral in class SimpleTreeVisitor<Void,AnnotatedTypeMirror>