| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.sun.source.util.TreeScanner<R,P>
com.sun.source.util.TreePathScanner<R,P>
checkers.source.SourceVisitor<R,P>
checkers.basetype.BaseTypeVisitor<Void,Void>
checkers.nullness.NullnessVisitor
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:
this or super) can always be dereferenced.
NullnessSubchecker| Modifier and Type | Field and Description | 
|---|
| Fields inherited from class checkers.basetype.BaseTypeVisitor | 
|---|
| annoFactory, annoTypes, checker, plainFactory, visitorState | 
| Fields inherited from class checkers.source.SourceVisitor | 
|---|
| atypeFactory, elements, root, trees, types | 
| Constructor and Description | 
|---|
| NullnessVisitor(NullnessSubchecker checker,
                CompilationUnitTree root)Creates a new visitor for type-checking NonNull. | 
| Modifier and Type | Method and Description | 
|---|---|
| protected  void | checkForRedundantTests(BinaryTree node) | 
| protected  boolean | checkMethodInvocability(AnnotatedTypeMirror.AnnotatedExecutableType method,
                        MethodInvocationTree node)Special casing NonNull and Raw method calls | 
| protected  void | commonAssignmentCheck(Tree varTree,
                      ExpressionTree valueExp,
                      String errorKey,
                      Void p)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 does. | 
|  Void | visitArrayAccess(ArrayAccessTree node,
                 Void p)Case 3: Check for array dereferencing | 
|  Void | visitAssert(AssertTree node,
            Void p) | 
|  Void | visitAssignment(AssignmentTree node,
                Void p)Performs two checks: subtyping and assignability checks, using BaseTypeVisitor.commonAssignmentCheck(Tree, ExpressionTree, String, Object). | 
|  Void | visitBinary(BinaryTree node,
            Void p)Case 6: Check for redundant nullness tests Case 7: unboxing case: primitive operations | 
|  Void | visitCompoundAssignment(CompoundAssignmentTree node,
                        Void p)Case 7: unboxing case: primitive operation | 
|  Void | visitEnhancedForLoop(EnhancedForLoopTree node,
                     Void p)Case 2: Check for implicit .iteratorcall | 
|  Void | visitIf(IfTree node,
        Void p) | 
|  Void | visitMemberSelect(MemberSelectTree node,
                  Void p)Case 1: Check for null dereferecing | 
|  Void | visitMethod(MethodTree node,
            Void p)Performs pseudo-assignment check: checks that the method obeys override and subtype rules to all overridden methods. | 
|  Void | visitSynchronized(SynchronizedTree node,
                  Void p)Case 5: Check for synchronizing locks | 
|  Void | visitThrow(ThrowTree node,
           Void p)Case 4: Check for thrown exception nullness | 
|  Void | visitTypeCast(TypeCastTree node,
              Void p)Case 7: unboxing case: casting to a primitive | 
|  Void | visitUnary(UnaryTree node,
           Void p)Case 7: unboxing case: primitive operation | 
| Methods inherited from class com.sun.source.util.TreePathScanner | 
|---|
| getCurrentPath, scan | 
| Methods inherited from class com.sun.source.util.TreeScanner | 
|---|
| reduce, scan, visitAnnotatedType, visitArrayType, visitBlock, visitBreak, visitCase, visitCatch, visitConditionalExpression, visitContinue, visitDoWhileLoop, visitEmptyStatement, visitErroneous, visitExpressionStatement, visitForLoop, 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 | 
| Constructor Detail | 
|---|
public NullnessVisitor(NullnessSubchecker checker,
                       CompilationUnitTree root)
NonNull.
checker - the checker to useroot - the root of the input program's AST to check| Method Detail | 
|---|
public Void visitMemberSelect(MemberSelectTree node,
                              Void p)
visitMemberSelect in interface TreeVisitor<Void,Void>visitMemberSelect in class TreeScanner<Void,Void>
public Void visitEnhancedForLoop(EnhancedForLoopTree node,
                                 Void p)
.iterator call
visitEnhancedForLoop in interface TreeVisitor<Void,Void>visitEnhancedForLoop in class BaseTypeVisitor<Void,Void>
public Void visitArrayAccess(ArrayAccessTree node,
                             Void p)
visitArrayAccess in interface TreeVisitor<Void,Void>visitArrayAccess in class TreeScanner<Void,Void>
public Void visitThrow(ThrowTree node,
                       Void p)
visitThrow in interface TreeVisitor<Void,Void>visitThrow in class TreeScanner<Void,Void>
public Void visitSynchronized(SynchronizedTree node,
                              Void p)
visitSynchronized in interface TreeVisitor<Void,Void>visitSynchronized in class TreeScanner<Void,Void>
public Void visitAssert(AssertTree node,
                        Void p)
visitAssert in interface TreeVisitor<Void,Void>visitAssert in class TreeScanner<Void,Void>
public Void visitIf(IfTree node,
                    Void p)
visitIf in interface TreeVisitor<Void,Void>visitIf in class TreeScanner<Void,Void>protected void checkForRedundantTests(BinaryTree node)
public Void visitBinary(BinaryTree node,
                        Void p)
visitBinary in interface TreeVisitor<Void,Void>visitBinary in class TreeScanner<Void,Void>
public Void visitUnary(UnaryTree node,
                       Void p)
visitUnary in interface TreeVisitor<Void,Void>visitUnary in class BaseTypeVisitor<Void,Void>
public Void visitCompoundAssignment(CompoundAssignmentTree node,
                                    Void p)
visitCompoundAssignment in interface TreeVisitor<Void,Void>visitCompoundAssignment in class BaseTypeVisitor<Void,Void>
public Void visitTypeCast(TypeCastTree node,
                          Void p)
visitTypeCast in interface TreeVisitor<Void,Void>visitTypeCast in class BaseTypeVisitor<Void,Void>
protected void commonAssignmentCheck(Tree varTree,
                                     ExpressionTree valueExp,
                                     String errorKey,
                                     Void p)
BaseTypeVisitor
commonAssignmentCheck in class BaseTypeVisitor<Void,Void>varTree - the AST node for the variablevalueExp - the AST node for the valueerrorKey - the error message to use if the check failsp - a checker-specified parameter
public Void visitMethod(MethodTree node,
                        Void p)
BaseTypeVisitor
visitMethod in interface TreeVisitor<Void,Void>visitMethod in class BaseTypeVisitor<Void,Void>
public Void visitAssignment(AssignmentTree node,
                            Void p)
BaseTypeVisitorBaseTypeVisitor.commonAssignmentCheck(Tree, ExpressionTree, String, Object).
 If the subtype check fails, it issues a "assignment.invalid" error.
visitAssignment in interface TreeVisitor<Void,Void>visitAssignment in class BaseTypeVisitor<Void,Void>
protected boolean checkMethodInvocability(AnnotatedTypeMirror.AnnotatedExecutableType method,
                                          MethodInvocationTree node)
checkMethodInvocability in class BaseTypeVisitor<Void,Void>method - the type of the invoked methodnode - the method invocation node| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||