checkers.types
Class TreeAnnotator

java.lang.Object
  extended by com.sun.source.util.SimpleTreeVisitor<Void,AnnotatedTypeMirror>
      extended by checkers.types.TreeAnnotator
All Implemented Interfaces:
TreeVisitor<Void,AnnotatedTypeMirror>
Direct Known Subclasses:
PropertyKeyAnnotatedTypeFactory.KeyLookupTreeAnnotator

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
DEFAULT_VALUE
 
Constructor Summary
Constructor and Description
TreeAnnotator(BaseTypeChecker checker, AnnotatedTypeFactory typeFactory)
          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)
           
 Void visitNewArray(NewArrayTree 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, visitDisjointType, visitDoWhileLoop, visitEmptyStatement, visitEnhancedForLoop, visitErroneous, visitExpressionStatement, visitForLoop, visitIdentifier, visitIf, visitImport, visitInstanceOf, visitLabeledStatement, visitMemberSelect, visitMethod, visitMethodInvocation, visitModifiers, 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

TreeAnnotator

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

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

defaultAction

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

visitLiteral

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

visitNewArray

public Void visitNewArray(NewArrayTree tree,
                          AnnotatedTypeMirror type)
Specified by:
visitNewArray in interface TreeVisitor<Void,AnnotatedTypeMirror>
Overrides:
visitNewArray in class SimpleTreeVisitor<Void,AnnotatedTypeMirror>