Class NullnessQualifierInference

java.lang.Object
com.sun.source.util.TreeScanner<Void,Void>
com.google.errorprone.dataflow.nullnesspropagation.inference.NullnessQualifierInference
All Implemented Interfaces:
com.sun.source.tree.TreeVisitor<Void,Void>

public class NullnessQualifierInference extends com.sun.source.util.TreeScanner<Void,Void>
Eagerly traverse one MethodTree at a time and accumulate constraints between nullness qualifiers. Those constraints are then solved as needed in InferredNullability. Based on Java type inference as defined in JLS section 18.
Author:
bennostein@google.com (Benno Stein)
  • Method Summary

    Modifier and Type
    Method
    Description
    getInferredNullability(com.sun.source.tree.Tree methodOrInitializerOrLambda)
     
    visitAssignment(com.sun.source.tree.AssignmentTree node, Void unused)
     
    visitIdentifier(com.sun.source.tree.IdentifierTree node, Void unused)
     
    visitMethodInvocation(com.sun.source.tree.MethodInvocationTree node, Void unused)
     
    visitReturn(com.sun.source.tree.ReturnTree node, Void unused)
     
    visitVariable(com.sun.source.tree.VariableTree node, Void unused)
     

    Methods inherited from class com.sun.source.util.TreeScanner

    reduce, scan, scan, visitAnnotatedType, visitAnnotation, visitAnyPattern, visitArrayAccess, visitArrayType, visitAssert, visitBinary, visitBindingPattern, visitBlock, visitBreak, visitCase, visitCatch, visitClass, visitCompilationUnit, visitCompoundAssignment, visitConditionalExpression, visitConstantCaseLabel, visitContinue, visitDeconstructionPattern, visitDefaultCaseLabel, visitDoWhileLoop, visitEmptyStatement, visitEnhancedForLoop, visitErroneous, visitExports, visitExpressionStatement, visitForLoop, visitIf, visitImport, visitInstanceOf, visitIntersectionType, visitLabeledStatement, visitLambdaExpression, visitLiteral, visitMemberReference, visitMemberSelect, visitMethod, visitModifiers, visitModule, visitNewArray, visitNewClass, visitOpens, visitOther, visitPackage, visitParameterizedType, visitParenthesized, visitPatternCaseLabel, visitPrimitiveType, visitProvides, visitRequires, visitSwitch, visitSwitchExpression, visitSynchronized, visitThrow, visitTry, visitTypeCast, visitTypeParameter, visitUnary, visitUnionType, visitUses, visitWhileLoop, visitWildcard, visitYield

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getInferredNullability

      public static InferredNullability getInferredNullability(com.sun.source.tree.Tree methodOrInitializerOrLambda)
    • visitIdentifier

      public Void visitIdentifier(com.sun.source.tree.IdentifierTree node, Void unused)
      Specified by:
      visitIdentifier in interface com.sun.source.tree.TreeVisitor<Void,Void>
      Overrides:
      visitIdentifier in class com.sun.source.util.TreeScanner<Void,Void>
    • visitAssignment

      public Void visitAssignment(com.sun.source.tree.AssignmentTree node, Void unused)
      Specified by:
      visitAssignment in interface com.sun.source.tree.TreeVisitor<Void,Void>
      Overrides:
      visitAssignment in class com.sun.source.util.TreeScanner<Void,Void>
    • visitVariable

      public Void visitVariable(com.sun.source.tree.VariableTree node, Void unused)
      Specified by:
      visitVariable in interface com.sun.source.tree.TreeVisitor<Void,Void>
      Overrides:
      visitVariable in class com.sun.source.util.TreeScanner<Void,Void>
    • visitReturn

      public Void visitReturn(com.sun.source.tree.ReturnTree node, Void unused)
      Specified by:
      visitReturn in interface com.sun.source.tree.TreeVisitor<Void,Void>
      Overrides:
      visitReturn in class com.sun.source.util.TreeScanner<Void,Void>
    • visitMethodInvocation

      public Void visitMethodInvocation(com.sun.source.tree.MethodInvocationTree node, Void unused)
      Specified by:
      visitMethodInvocation in interface com.sun.source.tree.TreeVisitor<Void,Void>
      Overrides:
      visitMethodInvocation in class com.sun.source.util.TreeScanner<Void,Void>