checkers.lock
Class LockVisitor
java.lang.Object
   com.sun.source.util.TreeScanner<R,P>
com.sun.source.util.TreeScanner<R,P>
       com.sun.source.util.TreePathScanner<R,P>
com.sun.source.util.TreePathScanner<R,P>
           checkers.source.SourceVisitor<R,P>
checkers.source.SourceVisitor<R,P>
               checkers.basetype.BaseTypeVisitor<Void,Void>
checkers.basetype.BaseTypeVisitor<Void,Void>
                   checkers.lock.LockVisitor
checkers.lock.LockVisitor
- All Implemented Interfaces:
- TreeVisitor<Void,Void>
public class LockVisitor
extends BaseTypeVisitor<Void,Void>
A type-checking visitor for the Lock type system.
 This visitor reports errors ("unguarded.access") or warnings for violations
 for accessing a field or calling a method without holding their locks.
 
 
 
 
Method Summary
| protected  boolean | checkMethodInvocability(AnnotatedTypeMirror.AnnotatedExecutableType method,
                        MethodInvocationTree node)Tests whether the method can be invoked using the receiver of the 'node'
 method invocation, and issues a "method.invocation.invalid" if the
 invocation is invalid.
 | 
| protected  boolean | checkOverride(MethodTree overriderTree,
              AnnotatedTypeMirror.AnnotatedDeclaredType enclosingType,
              AnnotatedTypeMirror.AnnotatedExecutableType overridden,
              AnnotatedTypeMirror.AnnotatedDeclaredType overriddenType,
              Void p)Checks that an overriding method's return type, parameter types, and
 receiver type are correct with respect to the annotations on the
 overridden method's return type, parameter types, and receiver type.
 | 
|  Void | visitIdentifier(IdentifierTree node,
                Void p)
 | 
|  Void | visitMemberSelect(MemberSelectTree node,
                  Void p)
 | 
|  Void | visitMethod(MethodTree node,
            Void p)Performs pseudo-assignment check: checks that the method obeys override
 and subtype rules to all overridden methods.
 | 
|  Void | visitMethodInvocation(MethodInvocationTree node,
                      Void p)Performs a method invocation check.
 | 
|  Void | visitSynchronized(SynchronizedTree node,
                  Void p)
 | 
 
| Methods inherited from class checkers.basetype.BaseTypeVisitor | 
| checkAccess, checkArguments, checkArrayInitialization, checkAssignability, checkConstructorInvocation, checkTypeArguments, checkTypecastSafety, commonAssignmentCheck, commonAssignmentCheck, commonAssignmentCheck, enclosingMemberSelect, isAccessAllowed, scan, shouldSkip, shouldSkip, validateTypeOf, visitAnnotation, visitAssignment, visitClass, visitCompilationUnit, visitCompoundAssignment, visitEnhancedForLoop, visitInstanceOf, 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, visitModifiers, visitOther, visitParenthesized, visitPrimitiveType, visitSwitch, visitThrow, visitTry, visitTypeParameter, visitWhileLoop, visitWildcard | 
 
| Methods inherited from class java.lang.Object | 
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
 
LockVisitor
public LockVisitor(LockChecker checker,
                   CompilationUnitTree root)
visitIdentifier
public Void visitIdentifier(IdentifierTree node,
                            Void p)
- 
- Specified by:
- visitIdentifierin interface- TreeVisitor<Void,Void>
- Overrides:
- visitIdentifierin class- BaseTypeVisitor<Void,Void>
 
visitMemberSelect
public Void visitMemberSelect(MemberSelectTree node,
                              Void p)
- 
- Specified by:
- visitMemberSelectin interface- TreeVisitor<Void,Void>
- Overrides:
- visitMemberSelectin class- TreeScanner<Void,Void>
 
visitSynchronized
public Void visitSynchronized(SynchronizedTree node,
                              Void p)
- 
- Specified by:
- visitSynchronizedin interface- TreeVisitor<Void,Void>
- Overrides:
- visitSynchronizedin class- TreeScanner<Void,Void>
 
visitMethod
public Void visitMethod(MethodTree node,
                        Void p)
- Description copied from class: BaseTypeVisitor
- Performs pseudo-assignment check: checks that the method obeys override
 and subtype rules to all overridden methods.
 The override rule specifies that a method, m1, may override a method
 m2 only if:
 
  -  m1 return type is a subtype of m2 
-  m1 receiver type is a supertype of m2 
- 
  
-  m1 parameters are supertypes of corresponding m2 parameters 
 Also, it issues a "missing.this" error for static method annotated
 receivers.
 
- 
- Specified by:
- visitMethodin interface- TreeVisitor<Void,Void>
- Overrides:
- visitMethodin class- BaseTypeVisitor<Void,Void>
 
visitMethodInvocation
public Void visitMethodInvocation(MethodInvocationTree node,
                                  Void p)
- Description copied from class: BaseTypeVisitor
- Performs a method invocation check.
 An invocation of a method, m, on the receiver, r is valid only if:
 
  -  passed arguments are subtypes of corresponding m parameters 
-  r is a subtype of m receiver type 
-  if m is generic, passed type arguments are subtypes
      of m type variables 
- 
 
 
 
- 
- Specified by:
- visitMethodInvocationin interface- TreeVisitor<Void,Void>
- Overrides:
- visitMethodInvocationin class- BaseTypeVisitor<Void,Void>
 
checkOverride
protected boolean checkOverride(MethodTree overriderTree,
                                AnnotatedTypeMirror.AnnotatedDeclaredType enclosingType,
                                AnnotatedTypeMirror.AnnotatedExecutableType overridden,
                                AnnotatedTypeMirror.AnnotatedDeclaredType overriddenType,
                                Void p)
- Description copied from class: BaseTypeVisitor
- Checks that an overriding method's return type, parameter types, and
 receiver type are correct with respect to the annotations on the
 overridden method's return type, parameter types, and receiver type.
 
 This method returns the result of the check, but also emits error
 messages as a side effect.
 
 
- 
- Overrides:
- checkOverridein class- BaseTypeVisitor<Void,Void>
 
- 
- Parameters:
- overriderTree- the AST node of the overriding method
- enclosingType- the declared type enclosing the overrider method
- overridden- the type of the overridden method
- overriddenType- the declared type enclosing the overridden method
- p- an optional parameter (as supplied to visitor methods)
- Returns:
- true if the override check passed, false otherwise
 
checkMethodInvocability
protected boolean checkMethodInvocability(AnnotatedTypeMirror.AnnotatedExecutableType method,
                                          MethodInvocationTree node)
- Description copied from class: BaseTypeVisitor
- Tests whether the method can be invoked using the receiver of the 'node'
 method invocation, and issues a "method.invocation.invalid" if the
 invocation is invalid.
 This implementation tests whether the receiver in the method invocation
 is a subtype of the method receiver type.
 
- 
- Overrides:
- checkMethodInvocabilityin class- BaseTypeVisitor<Void,Void>
 
- 
- Parameters:
- method- the type of the invoked method
- node- the method invocation node
- Returns:
- true iff the call of 'node' is a valid call