checkers.javari
Class JavariVisitor

java.lang.Object
  extended by com.sun.source.util.TreeScanner<R,P>
      extended by com.sun.source.util.TreePathScanner<R,P>
          extended by checkers.source.SourceVisitor<R,P>
              extended by checkers.basetype.BaseTypeVisitor<Void,Void>
                  extended by checkers.javari.JavariVisitor
All Implemented Interfaces:
TreeVisitor<Void,Void>

public class JavariVisitor
extends BaseTypeVisitor<Void,Void>

A type-checking visitor for the Javari mutability annotations (@ReadOnly, @Mutable and @Assignable) that extends BaseTypeVisitor.

See Also:
BaseTypeVisitor

Field Summary
 
Fields inherited from class checkers.basetype.BaseTypeVisitor
annoFactory, annoTypes, checker, plainFactory, visitorState
 
Fields inherited from class checkers.source.SourceVisitor
atypeFactory, elements, root, trees, types
 
Constructor Summary
JavariVisitor(JavariChecker checker, CompilationUnitTree root)
          Creates a new visitor for type-checking the Javari mutability annotations.
 
Method Summary
protected  void checkAssignability(AnnotatedTypeMirror varType, Tree varTree)
          Checks whether the variable represented by the given type and tree can be assigned, causing a checker error otherwise.
 void validateTypeOf(Tree tree)
          Tests whether the tree expressed by the passed type tree contains a qualified primitive type on its qualified type, and if so emits an error.
 Void visitClass(ClassTree node, Void p)
          Ensures the class type is not @PolyRead outside a @PolyRead context.
 
Methods inherited from class checkers.basetype.BaseTypeVisitor
checkAccess, checkArguments, checkArrayInitialization, checkConstructorInvocation, checkMethodInvocability, checkOverride, checkTypeArguments, checkTypecastSafety, commonAssignmentCheck, commonAssignmentCheck, commonAssignmentCheck, enclosingMemberSelect, isAccessAllowed, scan, shouldSkip, shouldSkip, visitAnnotation, visitAssignment, visitCompilationUnit, visitCompoundAssignment, visitEnhancedForLoop, visitIdentifier, visitInstanceOf, visitMethod, visitMethodInvocation, visitNewArray, visitNewClass, visitParameterizedType, visitReturn, visitTypeCast, visitUnary, visitVariable
 
Methods inherited from class com.sun.source.util.TreePathScanner
getCurrentPath, scan
 
Methods inherited from class com.sun.source.util.TreeScanner
reduce, scan, visitAnnotatedType, visitArrayAccess, visitArrayType, visitAssert, visitBinary, visitBlock, visitBreak, visitCase, visitCatch, visitConditionalExpression, visitContinue, visitDoWhileLoop, visitEmptyStatement, visitErroneous, visitExpressionStatement, visitForLoop, visitIf, visitImport, visitLabeledStatement, visitLiteral, visitMemberSelect, visitModifiers, visitOther, visitParenthesized, visitPrimitiveType, visitSwitch, visitSynchronized, visitThrow, visitTry, visitTypeParameter, visitWhileLoop, visitWildcard
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavariVisitor

public JavariVisitor(JavariChecker checker,
                     CompilationUnitTree root)
Creates a new visitor for type-checking the Javari mutability annotations.

Parameters:
checker - the JavariChecker to use
root - the root of the input program's AST to check
Method Detail

visitClass

public Void visitClass(ClassTree node,
                       Void p)
Ensures the class type is not @PolyRead outside a @PolyRead context.

Specified by:
visitClass in interface TreeVisitor<Void,Void>
Overrides:
visitClass in class BaseTypeVisitor<Void,Void>

checkAssignability

protected void checkAssignability(AnnotatedTypeMirror varType,
                                  Tree varTree)
Checks whether the variable represented by the given type and tree can be assigned, causing a checker error otherwise.

Overrides:
checkAssignability in class BaseTypeVisitor<Void,Void>
Parameters:
varType - the type of the variable being re-assigned
varTree - the tree used to access the variable in the assignment

validateTypeOf

public void validateTypeOf(Tree tree)
Tests whether the tree expressed by the passed type tree contains a qualified primitive type on its qualified type, and if so emits an error.

Overrides:
validateTypeOf in class BaseTypeVisitor<Void,Void>
Parameters:
tree - the AST type supplied by the user