|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.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
public class JavariVisitor
A type-checking visitor for the Javari mutability annotations
(@ReadOnly
, @Mutable
and @Assignable
) that
extends BaseTypeVisitor.
BaseTypeVisitor
Field Summary |
---|
Fields inherited from class checkers.basetype.BaseTypeVisitor |
---|
annoFactory, annoTypes, checker, 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 |
checkArguments(List<? extends AnnotatedTypeMirror> requiredArgs,
List<? extends ExpressionTree> passedArgs,
Void p)
Overriding assignment check to annotate every {code @PolyRead} parameter with {code @ReadOnly}. |
protected boolean |
checkMethodInvocability(AnnotatedTypeMirror.AnnotatedExecutableType method,
MethodInvocationTree node)
Overriding invocability check to let {code @ReadOnly} references invoke {code @PolyRead} methods. |
protected void |
commonAssignmentCheck(AnnotatedTypeMirror varType,
AnnotatedTypeMirror valueType,
Tree valueTree,
String errorKey,
Void p)
Overrides its super method, calling the assignment check unless the error key is generic.argument.invalid and the upper bound is java.lang.Object . |
protected void |
commonAssignmentCheck(Tree varTree,
ExpressionTree valueTree,
String errorKey,
Void p)
Checks whether the local field of a readonly reference is being assigned, before calling commonAssignmentCheck to proceed with subtype checking. |
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 valid. |
Void |
visitTypeCast(TypeCastTree node,
Void p)
Emits a warning if a cast is made increasing mutability. |
Void |
visitUnary(UnaryTree node,
Void p)
Checks for prefix and postfix increments and decrements on unassignable fields of readonly classes. |
Methods inherited from class checkers.basetype.BaseTypeVisitor |
---|
checkAssignability, checkOverride, checkTypeArguments, commonAssignmentCheck, scan, shouldSkip, shouldSkip, visitAnnotation, visitAssignment, visitCompilationUnit, visitCompoundAssignment, visitEnhancedForLoop, visitInstanceOf, visitMethod, visitMethodInvocation, visitNewArray, visitNewClass, visitParameterizedType, visitReturn, visitVariable |
Methods inherited from class com.sun.source.util.TreePathScanner |
---|
getCurrentPath, scan |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JavariVisitor(JavariChecker checker, CompilationUnitTree root)
checker
- the JavariChecker
to useroot
- the root of the input program's AST to checkMethod Detail |
---|
public Void visitClass(ClassTree node, Void p)
visitClass
in interface TreeVisitor<Void,Void>
visitClass
in class BaseTypeVisitor<Void,Void>
protected void commonAssignmentCheck(AnnotatedTypeMirror varType, AnnotatedTypeMirror valueType, Tree valueTree, String errorKey, Void p)
commonAssignmentCheck
in class BaseTypeVisitor<Void,Void>
varType
- the annotated type of the variablevalueType
- the annotated type of the valuevalueTree
- the location to use when reporting the error messageerrorKey
- the error message to use if the check failsp
- a checker-specified parameterprotected void commonAssignmentCheck(Tree varTree, ExpressionTree valueTree, String errorKey, Void p)
commonAssignmentCheck
in class BaseTypeVisitor<Void,Void>
varTree
- the AST node for the variablevalueTree
- the AST node for the valueerrorKey
- the error message to use if the check failsp
- a checker-specified parameterpublic Void visitUnary(UnaryTree node, Void p)
visitUnary
in interface TreeVisitor<Void,Void>
visitUnary
in class BaseTypeVisitor<Void,Void>
TreeScanner.visitUnary(com.sun.source.tree.UnaryTree,java.lang.Object)
public void validateTypeOf(Tree tree)
validateTypeOf
in class BaseTypeVisitor<Void,Void>
tree
- the AST type supplied by the userpublic Void visitTypeCast(TypeCastTree node, Void p)
visitTypeCast
in interface TreeVisitor<Void,Void>
visitTypeCast
in class BaseTypeVisitor<Void,Void>
TreeScanner.visitTypeCast(com.sun.source.tree.TypeCastTree,java.lang.Object)
protected boolean checkMethodInvocability(AnnotatedTypeMirror.AnnotatedExecutableType method, MethodInvocationTree node)
checkMethodInvocability
in class BaseTypeVisitor<Void,Void>
method
- the type of the invoked methodnode
- the method invocation node
protected void checkArguments(List<? extends AnnotatedTypeMirror> requiredArgs, List<? extends ExpressionTree> passedArgs, Void p)
checkArguments
in class BaseTypeVisitor<Void,Void>
requiredArgs
- the required typespassedArgs
- the expressions passed to the corresponding types
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |