public class LockVisitor extends org.checkerframework.common.basetype.BaseTypeVisitor<LockAnnotatedTypeFactory>
| Modifier and Type | Field and Description |
|---|---|
protected static Pattern |
SELF_RECEIVER_PATTERN |
| Constructor and Description |
|---|
LockVisitor(org.checkerframework.common.basetype.BaseTypeChecker checker) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
checkOverride(MethodTree overriderTree,
org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedDeclaredType enclosingType,
org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedExecutableType overridden,
org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedDeclaredType overriddenType)
Ensures that subclass methods are annotated with a stronger or equally strong side effect
annotation than the parent class method.
|
protected void |
commonAssignmentCheck(org.checkerframework.framework.type.AnnotatedTypeMirror varType,
org.checkerframework.framework.type.AnnotatedTypeMirror valueType,
Tree valueTree,
@CompilerMessageKey String errorKey) |
LockAnnotatedTypeFactory |
createTypeFactory() |
protected Set<? extends AnnotationMirror> |
getExceptionParameterLowerBoundAnnotations() |
boolean |
isValidUse(org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedDeclaredType declarationType,
org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedDeclaredType useType,
Tree tree)
Skips the call to super and returns true.
|
void |
processClassTree(ClassTree node)
Disallows annotations from the @GuardedBy hierarchy on class declarations (other
than @GuardedBy({}).
|
protected boolean |
skipReceiverSubtypeCheck(MethodInvocationTree methodInvocationTree,
org.checkerframework.framework.type.AnnotatedTypeMirror methodDefinitionReceiver,
org.checkerframework.framework.type.AnnotatedTypeMirror methodCallReceiver)
When visiting a method call, if the receiver formal parameter has type @GuardSatisfied and
the receiver actual parameter has type @GuardedBy(...), this method verifies that the guard
is satisfied, and it returns true, indicating that the receiver subtype check should be
skipped.
|
Void |
visitAnnotation(AnnotationTree tree,
Void p) |
Void |
visitArrayAccess(ArrayAccessTree tree,
Void p) |
Void |
visitBinary(BinaryTree binaryTree,
Void p) |
Void |
visitCompoundAssignment(CompoundAssignmentTree node,
Void p) |
Void |
visitIdentifier(IdentifierTree tree,
Void p) |
Void |
visitMemberSelect(MemberSelectTree tree,
Void p) |
Void |
visitMethod(MethodTree node,
Void p)
Issues an error if a method (explicitly or implicitly) annotated with @MayReleaseLocks has a
formal parameter or receiver (explicitly or implicitly) annotated with @GuardSatisfied.
|
Void |
visitMethodInvocation(MethodInvocationTree node,
Void p)
When visiting a method invocation, issue an error if the side effect annotation on the called
method causes the side effect guarantee of the enclosing method to be violated.
|
Void |
visitSynchronized(SynchronizedTree node,
Void p)
When visiting a synchronized block, issue an error if the expression has a type that
implements the java.util.concurrent.locks.Lock interface.
|
Void |
visitVariable(VariableTree node,
Void p) |
checkAccess, checkArguments, checkArrayInitialization, checkAssignability, checkConditionalPostcondition, checkConstructorInvocation, checkContract, checkDefaultConstructor, checkExceptionParameter, checkFieldInvariantDeclarations, checkForAnnotatedJdk, checkMethodInvocability, checkMethodReferenceAsOverride, checkOverride, checkPostcondition, checkPreconditions, checkThrownExpression, checkTypeArguments, checkTypecastRedundancy, checkTypecastSafety, checkVarargs, commonAssignmentCheck, commonAssignmentCheck, createOverrideChecker, createTypeValidator, enclosingMemberSelect, enclosingStatement, getThrowUpperBoundAnnotations, getTypeFactory, isAccessAllowed, isAssignable, isValidUse, isValidUse, isVectorCopyInto, reportPurityErrors, scan, setRoot, shouldSkipUses, testTypevarContainment, typeCheckVectorCopyIntoArgument, validateType, validateTypeOf, visitAssignment, visitCatch, visitClass, visitCompilationUnit, visitConditionalExpression, visitEnhancedForLoop, visitInstanceOf, visitLambdaExpression, visitMemberReference, visitNewArray, visitNewClass, visitParameterizedType, visitReturn, visitThrow, visitTypeCast, visitTypeParameter, visitUnarygetCurrentPath, scanreduce, scan, visitAnnotatedType, visitArrayType, visitAssert, visitBlock, visitBreak, visitCase, visitContinue, visitDoWhileLoop, visitEmptyStatement, visitErroneous, visitExpressionStatement, visitForLoop, visitIf, visitImport, visitIntersectionType, visitLabeledStatement, visitLiteral, visitModifiers, visitOther, visitParenthesized, visitPrimitiveType, visitSwitch, visitTry, visitUnionType, visitWhileLoop, visitWildcardprotected static final Pattern SELF_RECEIVER_PATTERN
public LockVisitor(org.checkerframework.common.basetype.BaseTypeChecker checker)
public Void visitVariable(VariableTree node, Void p)
visitVariable in interface TreeVisitor<Void,Void>visitVariable in class org.checkerframework.common.basetype.BaseTypeVisitor<LockAnnotatedTypeFactory>public LockAnnotatedTypeFactory createTypeFactory()
createTypeFactory in class org.checkerframework.common.basetype.BaseTypeVisitor<LockAnnotatedTypeFactory>public Void visitMethod(MethodTree node, Void p)
visitMethod in interface TreeVisitor<Void,Void>visitMethod in class org.checkerframework.common.basetype.BaseTypeVisitor<LockAnnotatedTypeFactory>node - the MethodTree of the method definition to visitprotected boolean skipReceiverSubtypeCheck(MethodInvocationTree methodInvocationTree, org.checkerframework.framework.type.AnnotatedTypeMirror methodDefinitionReceiver, org.checkerframework.framework.type.AnnotatedTypeMirror methodCallReceiver)
skipReceiverSubtypeCheck in class org.checkerframework.common.basetype.BaseTypeVisitor<LockAnnotatedTypeFactory>methodInvocationTree - the MethodInvocationTree of the method being calledmethodDefinitionReceiver - the ATM of the formal receiver parameter of the method being
calledmethodCallReceiver - the ATM of the receiver argument of the method callprotected Set<? extends AnnotationMirror> getExceptionParameterLowerBoundAnnotations()
getExceptionParameterLowerBoundAnnotations in class org.checkerframework.common.basetype.BaseTypeVisitor<LockAnnotatedTypeFactory>protected void commonAssignmentCheck(org.checkerframework.framework.type.AnnotatedTypeMirror varType,
org.checkerframework.framework.type.AnnotatedTypeMirror valueType,
Tree valueTree,
@CompilerMessageKey String errorKey)
commonAssignmentCheck in class org.checkerframework.common.basetype.BaseTypeVisitor<LockAnnotatedTypeFactory>public Void visitMemberSelect(MemberSelectTree tree, Void p)
visitMemberSelect in interface TreeVisitor<Void,Void>visitMemberSelect in class TreeScanner<Void,Void>protected boolean checkOverride(MethodTree overriderTree, org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedDeclaredType enclosingType, org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedExecutableType overridden, org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedDeclaredType overriddenType)
checkOverride in class org.checkerframework.common.basetype.BaseTypeVisitor<LockAnnotatedTypeFactory>public Void visitArrayAccess(ArrayAccessTree tree, Void p)
visitArrayAccess in interface TreeVisitor<Void,Void>visitArrayAccess in class org.checkerframework.common.basetype.BaseTypeVisitor<LockAnnotatedTypeFactory>public boolean isValidUse(org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedDeclaredType declarationType,
org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedDeclaredType useType,
Tree tree)
GuardedBy({}) is the default type on class declarations, which is a subtype of the
top annotation @GuardedByUnknown. However, it is valid to declare an instance of a
class with any annotation from the @GuardedBy hierarchy. Hence, this method returns
true for annotations in the @GuardedBy hierarchy.
Also returns true for annotations in the @LockPossiblyHeld hierarchy since the
default for that hierarchy is the top type and annotations from that hierarchy cannot be
explicitly written in code.
isValidUse in class org.checkerframework.common.basetype.BaseTypeVisitor<LockAnnotatedTypeFactory>public Void visitMethodInvocation(MethodInvocationTree node, Void p)
visitMethodInvocation in interface TreeVisitor<Void,Void>visitMethodInvocation in class org.checkerframework.common.basetype.BaseTypeVisitor<LockAnnotatedTypeFactory>node - the MethodInvocationTree of the method call being visitedpublic Void visitSynchronized(SynchronizedTree node, Void p)
Additionally, a synchronized block may not be present in a method that has a @LockingFree guarantee or stronger. An error is issued in this case.
visitSynchronized in interface TreeVisitor<Void,Void>visitSynchronized in class TreeScanner<Void,Void>node - the SynchronizedTree for the synchronized block being visitedpublic Void visitAnnotation(AnnotationTree tree, Void p)
visitAnnotation in interface TreeVisitor<Void,Void>visitAnnotation in class org.checkerframework.common.basetype.BaseTypeVisitor<LockAnnotatedTypeFactory>public Void visitIdentifier(IdentifierTree tree, Void p)
visitIdentifier in interface TreeVisitor<Void,Void>visitIdentifier in class org.checkerframework.common.basetype.BaseTypeVisitor<LockAnnotatedTypeFactory>public void processClassTree(ClassTree node)
processClassTree in class org.checkerframework.common.basetype.BaseTypeVisitor<LockAnnotatedTypeFactory>public Void visitBinary(BinaryTree binaryTree, Void p)
visitBinary in interface TreeVisitor<Void,Void>visitBinary in class TreeScanner<Void,Void>public Void visitCompoundAssignment(CompoundAssignmentTree node, Void p)
visitCompoundAssignment in interface TreeVisitor<Void,Void>visitCompoundAssignment in class org.checkerframework.common.basetype.BaseTypeVisitor<LockAnnotatedTypeFactory>