public class LockVisitor extends BaseTypeVisitor<LockAnnotatedTypeFactory>
atypeFactory, checker, contractsUtils, positions, typeValidator, visitorState
elements, root, trees, types
Constructor and Description |
---|
LockVisitor(BaseTypeChecker checker) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
checkOverride(MethodTree overriderTree,
AnnotatedTypeMirror.AnnotatedDeclaredType enclosingType,
AnnotatedTypeMirror.AnnotatedExecutableType overridden,
AnnotatedTypeMirror.AnnotatedDeclaredType overriddenType,
Void p)
Type checks that a method may override another method.
|
protected void |
checkPreconditions(Tree tree,
Element invokedElement,
boolean methodCall,
Set<Pair<String,String>> additionalPreconditions)
Checks all the preconditions of the method invocation or variable access
tree with
element invokedElement . |
protected void |
commonAssignmentCheck(AnnotatedTypeMirror varType,
AnnotatedTypeMirror valueType,
Tree valueTree,
@CompilerMessageKey String errorKey)
Checks the validity of an assignment (or pseudo-assignment) from a value
to a variable and emits an error message (through the compiler's
messaging interface) if it is not valid.
|
LockAnnotatedTypeFactory |
createTypeFactory()
Constructs an instance of the appropriate type factory for the
implemented type system.
|
protected List<String> |
methodHolding(ExecutableElement element) |
protected List<String> |
methodHoldingOnEntry(ExecutableElement element) |
protected boolean |
skipContractCheck(Tree tree,
FlowExpressions.Receiver expr,
FlowExpressionParseUtil.FlowExpressionContext flowExprContext)
Whether to skip a contract check based on whether the @GuardedBy
expression
expr is valid for the tree tree
under the context flowExprContext
if the current path is within the expression
of a synchronized block (e.g. |
checkAccess, checkAccess, checkArguments, checkArrayInitialization, checkAssignability, checkConditionalPostconditions, checkConditionalPostconditionsConsistency, checkConstructorInvocation, checkContract, checkDefaultConstructor, checkExceptionParameter, checkFlowExprParameters, checkForAnnotatedJdk, checkMethodInvocability, checkMethodReferenceAsOverride, checkPostconditions, checkPostconditionsConsistency, checkPreconditions, checkPreconditionsConsistency, checkThrownExpression, checkTypeArguments, checkTypecastRedundancy, checkTypecastSafety, commonAssignmentCheck, commonAssignmentCheck, createTypeValidator, enclosingMemberSelect, enclosingStatement, getExceptionParameterLowerBoundAnnotations, getThrowUpperBoundAnnotations, getTypeFactory, isAccessAllowed, isAssignable, isValidUse, isValidUse, isValidUse, isVectorCopyInto, reportPurityErrors, scan, setRoot, shouldSkipUses, skipReceiverSubtypeCheck, testTypevarContainment, typeCheckVectorCopyIntoArgument, validateType, validateTypeOf, visitAnnotation, visitArrayAccess, visitAssignment, visitCatch, visitClass, visitCompilationUnit, visitCompoundAssignment, visitConditionalExpression, visitEnhancedForLoop, visitIdentifier, visitInstanceOf, visitLambdaExpression, visitMemberReference, visitMethod, visitMethodInvocation, visitNewArray, visitNewClass, visitParameterizedType, visitReturn, visitThrow, visitTypeCast, visitTypeParameter, visitUnary, visitVariable
visit
getCurrentPath, scan
reduce, scan, visitAnnotatedType, visitArrayType, visitAssert, visitBinary, visitBlock, visitBreak, visitCase, visitContinue, visitDoWhileLoop, visitEmptyStatement, visitErroneous, visitExpressionStatement, visitForLoop, visitIf, visitImport, visitIntersectionType, visitLabeledStatement, visitLiteral, visitMemberSelect, visitModifiers, visitOther, visitParenthesized, visitPrimitiveType, visitSwitch, visitSynchronized, visitTry, visitUnionType, visitWhileLoop, visitWildcard
public LockVisitor(BaseTypeChecker checker)
public LockAnnotatedTypeFactory createTypeFactory()
BaseTypeVisitor
BaseAnnotatedTypeFactory
. It reflectively invokes the
constructor that accepts this checker and compilation unit tree
(in that order) as arguments.
Subclasses have to override this method to create the appropriate
visitor if they do not follow the checker naming convention.createTypeFactory
in class BaseTypeVisitor<LockAnnotatedTypeFactory>
protected void commonAssignmentCheck(AnnotatedTypeMirror varType, AnnotatedTypeMirror valueType, Tree valueTree, @CompilerMessageKey String errorKey)
BaseTypeVisitor
commonAssignmentCheck
in class BaseTypeVisitor<LockAnnotatedTypeFactory>
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 fails (must be a
compiler message key, see CompilerMessageKey
)protected boolean checkOverride(MethodTree overriderTree, AnnotatedTypeMirror.AnnotatedDeclaredType enclosingType, AnnotatedTypeMirror.AnnotatedExecutableType overridden, AnnotatedTypeMirror.AnnotatedDeclaredType overriddenType, Void p)
BaseTypeVisitor
checkOverride
in class BaseTypeVisitor<LockAnnotatedTypeFactory>
overriderTree
- Declaration tree of overriding methodenclosingType
- Type of overriding classoverridden
- Type of overridden methodoverriddenType
- Type of overridden classprotected List<String> methodHolding(ExecutableElement element)
protected List<String> methodHoldingOnEntry(ExecutableElement element)
protected void checkPreconditions(Tree tree, Element invokedElement, boolean methodCall, Set<Pair<String,String>> additionalPreconditions)
tree
with
element invokedElement
.checkPreconditions
in class BaseTypeVisitor<LockAnnotatedTypeFactory>
protected boolean skipContractCheck(Tree tree, FlowExpressions.Receiver expr, FlowExpressionParseUtil.FlowExpressionContext flowExprContext)
expr
is valid for the tree tree
under the context flowExprContext
if the current path is within the expression
of a synchronized block (e.g. bar in
synchronized(bar) { ... }skipContractCheck
in class BaseTypeVisitor<LockAnnotatedTypeFactory>
tree
- The tree that is @GuardedBy.expr
- The expression of the @GuardedBy annotation.flowExprContext
- The current context.