checkers.javari
Class JavariVisitor
java.lang.Object
com.sun.source.util.TreeScanner<R,P>
com.sun.source.util.TreePathScanner<R,P>
checkers.source.SourceVisitor<R,P>
checkers.basetype.BaseTypeVisitor<Void,Void>
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
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, checkDefaultConstructor, checkMethodInvocability, checkOverride, checkTypeArguments, checkTypecastRedundancy, checkTypecastSafety, commonAssignmentCheck, commonAssignmentCheck, commonAssignmentCheck, enclosingMemberSelect, enclosingStatement, 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.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 |
JavariVisitor
public JavariVisitor(JavariChecker checker,
CompilationUnitTree root)
- Creates a new visitor for type-checking the Javari mutability
annotations.
- Parameters:
checker
- the JavariChecker
to useroot
- the root of the input program's AST to check
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-assignedvarTree
- 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