checkers.nullness
Class NullnessVisitor
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.nullness.NullnessVisitor
checkers.nullness.NullnessVisitor
- All Implemented Interfaces: 
- TreeVisitor<Void,Void>
- public class NullnessVisitor 
- extends BaseTypeVisitor<Void,Void>
A type-checking visitor for the Nullness type system.
 This visitor reports errors ("dereference.of.nullable") or
 warnings for violations for the following cases:
 1. if the receiver of a member dereference is not NonNull
 2. if the receiver of an implicit ".iterator()" dereference in an enhanced
    for loop is not NonNull
 3. if an accessed array is not NonNull
 Self-accesses (via this or super) can always be dereferenced.
- See Also:
- NullnessChecker
 
 
 
 
| 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.
 | 
|  Void | visitArrayAccess(ArrayAccessTree node,
                 Void p)
 | 
|  Void | visitBinary(BinaryTree node,
            Void p)
 | 
|  Void | visitCompoundAssignment(CompoundAssignmentTree node,
                        Void p)Performs assignability check using
 BaseTypeVisitor.checkAssignability(AnnotatedTypeMirror, Tree). | 
|  Void | visitEnhancedForLoop(EnhancedForLoopTree node,
                     Void p)Performs a subtype check, to test whether the node expression
 iterable type is a subtype of the variable type in the enhanced for
 loop.
 | 
|  Void | visitMemberSelect(MemberSelectTree node,
                  Void p)
 | 
|  Void | visitSynchronized(SynchronizedTree node,
                  Void p)
 | 
|  Void | visitThrow(ThrowTree node,
           Void p)
 | 
|  Void | visitUnary(UnaryTree node,
           Void p)Performs assignability check using
 BaseTypeVisitor.checkAssignability(AnnotatedTypeMirror, Tree). | 
 
| Methods inherited from class checkers.basetype.BaseTypeVisitor | 
| checkArguments, checkAssignability, checkOverride, checkTypeArguments, checkTypecastSafety, commonAssignmentCheck, commonAssignmentCheck, commonAssignmentCheck, scan, shouldSkip, shouldSkip, validateTypeOf, visitAnnotation, visitAssignment, visitClass, visitCompilationUnit, visitInstanceOf, visitMethod, visitMethodInvocation, visitNewArray, visitNewClass, visitParameterizedType, visitReturn, visitTypeCast, visitVariable | 
 
 
| Methods inherited from class com.sun.source.util.TreeScanner | 
| reduce, scan, visitAnnotatedType, visitArrayType, visitAssert, visitBlock, visitBreak, visitCase, visitCatch, visitConditionalExpression, visitContinue, visitDoWhileLoop, visitEmptyStatement, visitErroneous, visitExpressionStatement, visitForLoop, visitIdentifier, visitIf, visitImport, visitLabeledStatement, visitLiteral, visitModifiers, visitOther, visitParenthesized, visitPrimitiveType, visitSwitch, visitTry, visitTypeParameter, visitWhileLoop, visitWildcard | 
 
| Methods inherited from class java.lang.Object | 
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
 
NullnessVisitor
public NullnessVisitor(NullnessChecker checker,
                       CompilationUnitTree root)
- Creates a new visitor for type-checking NonNull.
 
- Parameters:
- checker- the checker to use
- root- the root of the input program's AST to check
 
visitMemberSelect
public Void visitMemberSelect(MemberSelectTree node,
                              Void p)
- 
- Specified by:
- visitMemberSelectin interface- TreeVisitor<Void,Void>
- Overrides:
- visitMemberSelectin class- TreeScanner<Void,Void>
 
- 
 
visitEnhancedForLoop
public Void visitEnhancedForLoop(EnhancedForLoopTree node,
                                 Void p)
- Description copied from class: BaseTypeVisitor
- Performs a subtype check, to test whether the node expression
 iterable type is a subtype of the variable type in the enhanced for
 loop.
 If the subtype check fails, it issues a "type.incompatible" error.
 
- 
- Specified by:
- visitEnhancedForLoopin interface- TreeVisitor<Void,Void>
- Overrides:
- visitEnhancedForLoopin class- BaseTypeVisitor<Void,Void>
 
- 
 
visitArrayAccess
public Void visitArrayAccess(ArrayAccessTree node,
                             Void p)
- 
- Specified by:
- visitArrayAccessin interface- TreeVisitor<Void,Void>
- Overrides:
- visitArrayAccessin class- TreeScanner<Void,Void>
 
- 
 
visitThrow
public Void visitThrow(ThrowTree node,
                       Void p)
- 
- Specified by:
- visitThrowin interface- TreeVisitor<Void,Void>
- Overrides:
- visitThrowin 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>
 
- 
 
visitUnary
public Void visitUnary(UnaryTree node,
                       Void p)
- Description copied from class: BaseTypeVisitor
- Performs assignability check using
 BaseTypeVisitor.checkAssignability(AnnotatedTypeMirror, Tree).
 
- 
- Specified by:
- visitUnaryin interface- TreeVisitor<Void,Void>
- Overrides:
- visitUnaryin class- BaseTypeVisitor<Void,Void>
 
- 
 
visitBinary
public Void visitBinary(BinaryTree node,
                        Void p)
- 
- Specified by:
- visitBinaryin interface- TreeVisitor<Void,Void>
- Overrides:
- visitBinaryin class- TreeScanner<Void,Void>
 
- 
 
visitCompoundAssignment
public Void visitCompoundAssignment(CompoundAssignmentTree node,
                                    Void p)
- Description copied from class: BaseTypeVisitor
- Performs assignability check using
 BaseTypeVisitor.checkAssignability(AnnotatedTypeMirror, Tree).
 
- 
- Specified by:
- visitCompoundAssignmentin interface- TreeVisitor<Void,Void>
- Overrides:
- visitCompoundAssignmentin class- BaseTypeVisitor<Void,Void>
 
- 
 
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