public class JavariVisitor extends BaseTypeVisitor<JavariChecker>
@ReadOnly
, @Mutable
and @Assignable
) that
extends BaseTypeVisitor.BaseTypeVisitor
BaseTypeVisitor.TypeValidator
annoFactory, annoTypes, checker, options, typeValidator, visitorState
atypeFactory, elements, root, trees, types
Constructor and Description |
---|
JavariVisitor(JavariChecker checker,
@Nullable CompilationUnitTree root)
Creates a new visitor for type-checking the Javari mutability
annotations.
|
Modifier and Type | Method and Description |
---|---|
protected void |
checkAssignability(@Mutable AnnotatedTypeMirror varType,
@Nullable Tree varTree)
Checks whether the variable represented by the given type and
tree can be assigned, causing a checker error otherwise.
|
boolean |
isValidUse(AnnotatedTypeMirror.AnnotatedDeclaredType elemType,
AnnotatedTypeMirror.AnnotatedDeclaredType useType)
Always true; no type validity checking is made by the BaseTypeVisitor.
|
boolean |
isValidUse(AnnotatedTypeMirror.AnnotatedPrimitiveType useType)
Tests that the qualifiers present on the primitive type are valid.
|
@Nullable Void |
visitClass(@Nullable ClassTree node,
@Nullable Void p)
Ensures the class type is not
@PolyRead outside a
@PolyRead context. |
checkAccess, checkArguments, checkArrayInitialization, checkConstructorInvocation, checkDefaultConstructor, checkForAnnotatedJdk, checkMethodInvocability, checkOverride, checkTypeArguments, checkTypecastRedundancy, checkTypecastSafety, commonAssignmentCheck, commonAssignmentCheck, commonAssignmentCheck, createTypeValidator, enclosingMemberSelect, enclosingStatement, isAccessAllowed, isAssignable, isValidUse, isVectorCopyInto, scan, shouldSkipUses, typeCheckVectorCopyIntoArgument, validateTypeOf, visitAnnotation, visitArrayAccess, visitAssignment, visitCompilationUnit, visitCompoundAssignment, visitConditionalExpression, visitEnhancedForLoop, visitIdentifier, visitInstanceOf, visitMethod, visitMethodInvocation, visitNewArray, visitNewClass, visitParameterizedType, visitReturn, visitTypeCast, visitTypeParameter, visitUnary, visitVariable
getCurrentPath, scan
reduce, scan, visitAnnotatedType, visitArrayType, visitAssert, visitBinary, visitBlock, visitBreak, visitCase, visitCatch, visitContinue, visitDoWhileLoop, visitEmptyStatement, visitErroneous, visitExpressionStatement, visitForLoop, visitIf, visitImport, visitLabeledStatement, visitLambdaExpression, visitLiteral, visitMemberReference, visitMemberSelect, visitModifiers, visitOther, visitParenthesized, visitPrimitiveType, visitSwitch, visitSynchronized, visitThrow, visitTry, visitUnionType, visitWhileLoop, visitWildcard
public JavariVisitor(JavariChecker checker, @Nullable CompilationUnitTree root)
checker
- the JavariChecker
to useroot
- the root of the input program's AST to checkpublic @Nullable Void visitClass(@Nullable ClassTree node, @Nullable Void p)
@PolyRead
outside a
@PolyRead
context.visitClass
in interface TreeVisitor<@Nullable Void,@Nullable Void>
visitClass
in class BaseTypeVisitor<JavariChecker>
protected void checkAssignability(@Mutable AnnotatedTypeMirror varType, @Nullable Tree varTree)
checkAssignability
in class BaseTypeVisitor<JavariChecker>
varType
- the type of the variable being re-assignedvarTree
- the tree used to access the variable in the assignmentpublic boolean isValidUse(AnnotatedTypeMirror.AnnotatedDeclaredType elemType, AnnotatedTypeMirror.AnnotatedDeclaredType useType)
isValidUse
in class BaseTypeVisitor<JavariChecker>
elemType
- the type of the class (TypeElement)useType
- the use of the class (instance type)BaseTypeVisitor
public boolean isValidUse(AnnotatedTypeMirror.AnnotatedPrimitiveType useType)
BaseTypeVisitor
isValidUse
in class BaseTypeVisitor<JavariChecker>