Class ControlFlowVisitor

java.lang.Object
com.sun.source.util.SimpleTreeVisitor<ControlFlowVisitor.Result,com.google.errorprone.refaster.ControlFlowVisitor.BreakContext>
com.google.errorprone.refaster.ControlFlowVisitor
All Implemented Interfaces:
com.sun.source.tree.TreeVisitor<ControlFlowVisitor.Result,com.google.errorprone.refaster.ControlFlowVisitor.BreakContext>

public class ControlFlowVisitor extends com.sun.source.util.SimpleTreeVisitor<ControlFlowVisitor.Result,com.google.errorprone.refaster.ControlFlowVisitor.BreakContext>
Analyzes a series of statements to determine whether they don't, sometimes, or never return.
Author:
lowasser@google.com (Louis Wasserman)
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    The state of whether a sequence of statements may return, break out of the visited statements, or neither.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final ControlFlowVisitor
     

    Fields inherited from class com.sun.source.util.SimpleTreeVisitor

    DEFAULT_VALUE
  • Method Summary

    Modifier and Type
    Method
    Description
    defaultAction(com.sun.source.tree.Tree node, com.google.errorprone.refaster.ControlFlowVisitor.BreakContext cxt)
     
    visitBlock(com.sun.source.tree.BlockTree node, com.google.errorprone.refaster.ControlFlowVisitor.BreakContext cxt)
     
    visitBreak(com.sun.source.tree.BreakTree node, com.google.errorprone.refaster.ControlFlowVisitor.BreakContext cxt)
     
    visitCase(com.sun.source.tree.CaseTree node, com.google.errorprone.refaster.ControlFlowVisitor.BreakContext cxt)
     
    visitCatch(com.sun.source.tree.CatchTree node, com.google.errorprone.refaster.ControlFlowVisitor.BreakContext cxt)
     
    visitContinue(com.sun.source.tree.ContinueTree node, com.google.errorprone.refaster.ControlFlowVisitor.BreakContext cxt)
     
    visitDoWhileLoop(com.sun.source.tree.DoWhileLoopTree node, com.google.errorprone.refaster.ControlFlowVisitor.BreakContext cxt)
     
    visitEnhancedForLoop(com.sun.source.tree.EnhancedForLoopTree node, com.google.errorprone.refaster.ControlFlowVisitor.BreakContext cxt)
     
    visitExpressionStatement(com.sun.source.tree.ExpressionStatementTree node, com.google.errorprone.refaster.ControlFlowVisitor.BreakContext cxt)
     
    visitForLoop(com.sun.source.tree.ForLoopTree node, com.google.errorprone.refaster.ControlFlowVisitor.BreakContext cxt)
     
    visitIf(com.sun.source.tree.IfTree node, com.google.errorprone.refaster.ControlFlowVisitor.BreakContext cxt)
     
    visitLabeledStatement(com.sun.source.tree.LabeledStatementTree node, com.google.errorprone.refaster.ControlFlowVisitor.BreakContext cxt)
     
    visitReturn(com.sun.source.tree.ReturnTree node, com.google.errorprone.refaster.ControlFlowVisitor.BreakContext cxt)
     
    visitStatement(com.sun.source.tree.StatementTree node)
     
    visitStatements(Iterable<? extends com.sun.source.tree.StatementTree> nodes)
     
    visitSwitch(com.sun.source.tree.SwitchTree node, com.google.errorprone.refaster.ControlFlowVisitor.BreakContext cxt)
     
    visitSynchronized(com.sun.source.tree.SynchronizedTree node, com.google.errorprone.refaster.ControlFlowVisitor.BreakContext cxt)
     
    visitThrow(com.sun.source.tree.ThrowTree node, com.google.errorprone.refaster.ControlFlowVisitor.BreakContext cxt)
     
    visitTry(com.sun.source.tree.TryTree node, com.google.errorprone.refaster.ControlFlowVisitor.BreakContext cxt)
     
    visitWhileLoop(com.sun.source.tree.WhileLoopTree node, com.google.errorprone.refaster.ControlFlowVisitor.BreakContext cxt)
     

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

    visit, visit, visitAnnotatedType, visitAnnotation, visitAnyPattern, visitArrayAccess, visitArrayType, visitAssert, visitAssignment, visitBinary, visitBindingPattern, visitClass, visitCompilationUnit, visitCompoundAssignment, visitConditionalExpression, visitConstantCaseLabel, visitDeconstructionPattern, visitDefaultCaseLabel, visitEmptyStatement, visitErroneous, visitExports, visitIdentifier, visitImport, visitInstanceOf, visitIntersectionType, visitLambdaExpression, visitLiteral, visitMemberReference, visitMemberSelect, visitMethod, visitMethodInvocation, visitModifiers, visitModule, visitNewArray, visitNewClass, visitOpens, visitOther, visitPackage, visitParameterizedType, visitParenthesized, visitPatternCaseLabel, visitPrimitiveType, visitProvides, visitRequires, visitSwitchExpression, visitTypeCast, visitTypeParameter, visitUnary, visitUnionType, visitUses, visitVariable, visitWildcard, visitYield

    Methods inherited from class java.lang.Object

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

  • Method Details

    • visitStatement

      public ControlFlowVisitor.Result visitStatement(com.sun.source.tree.StatementTree node)
    • visitStatements

      public ControlFlowVisitor.Result visitStatements(Iterable<? extends com.sun.source.tree.StatementTree> nodes)
    • defaultAction

      protected ControlFlowVisitor.Result defaultAction(com.sun.source.tree.Tree node, com.google.errorprone.refaster.ControlFlowVisitor.BreakContext cxt)
      Overrides:
      defaultAction in class com.sun.source.util.SimpleTreeVisitor<ControlFlowVisitor.Result,com.google.errorprone.refaster.ControlFlowVisitor.BreakContext>
    • visitBlock

      public ControlFlowVisitor.Result visitBlock(com.sun.source.tree.BlockTree node, com.google.errorprone.refaster.ControlFlowVisitor.BreakContext cxt)
      Specified by:
      visitBlock in interface com.sun.source.tree.TreeVisitor<ControlFlowVisitor.Result,com.google.errorprone.refaster.ControlFlowVisitor.BreakContext>
      Overrides:
      visitBlock in class com.sun.source.util.SimpleTreeVisitor<ControlFlowVisitor.Result,com.google.errorprone.refaster.ControlFlowVisitor.BreakContext>
    • visitDoWhileLoop

      public ControlFlowVisitor.Result visitDoWhileLoop(com.sun.source.tree.DoWhileLoopTree node, com.google.errorprone.refaster.ControlFlowVisitor.BreakContext cxt)
      Specified by:
      visitDoWhileLoop in interface com.sun.source.tree.TreeVisitor<ControlFlowVisitor.Result,com.google.errorprone.refaster.ControlFlowVisitor.BreakContext>
      Overrides:
      visitDoWhileLoop in class com.sun.source.util.SimpleTreeVisitor<ControlFlowVisitor.Result,com.google.errorprone.refaster.ControlFlowVisitor.BreakContext>
    • visitWhileLoop

      public ControlFlowVisitor.Result visitWhileLoop(com.sun.source.tree.WhileLoopTree node, com.google.errorprone.refaster.ControlFlowVisitor.BreakContext cxt)
      Specified by:
      visitWhileLoop in interface com.sun.source.tree.TreeVisitor<ControlFlowVisitor.Result,com.google.errorprone.refaster.ControlFlowVisitor.BreakContext>
      Overrides:
      visitWhileLoop in class com.sun.source.util.SimpleTreeVisitor<ControlFlowVisitor.Result,com.google.errorprone.refaster.ControlFlowVisitor.BreakContext>
    • visitForLoop

      public ControlFlowVisitor.Result visitForLoop(com.sun.source.tree.ForLoopTree node, com.google.errorprone.refaster.ControlFlowVisitor.BreakContext cxt)
      Specified by:
      visitForLoop in interface com.sun.source.tree.TreeVisitor<ControlFlowVisitor.Result,com.google.errorprone.refaster.ControlFlowVisitor.BreakContext>
      Overrides:
      visitForLoop in class com.sun.source.util.SimpleTreeVisitor<ControlFlowVisitor.Result,com.google.errorprone.refaster.ControlFlowVisitor.BreakContext>
    • visitEnhancedForLoop

      public ControlFlowVisitor.Result visitEnhancedForLoop(com.sun.source.tree.EnhancedForLoopTree node, com.google.errorprone.refaster.ControlFlowVisitor.BreakContext cxt)
      Specified by:
      visitEnhancedForLoop in interface com.sun.source.tree.TreeVisitor<ControlFlowVisitor.Result,com.google.errorprone.refaster.ControlFlowVisitor.BreakContext>
      Overrides:
      visitEnhancedForLoop in class com.sun.source.util.SimpleTreeVisitor<ControlFlowVisitor.Result,com.google.errorprone.refaster.ControlFlowVisitor.BreakContext>
    • visitSwitch

      public ControlFlowVisitor.Result visitSwitch(com.sun.source.tree.SwitchTree node, com.google.errorprone.refaster.ControlFlowVisitor.BreakContext cxt)
      Specified by:
      visitSwitch in interface com.sun.source.tree.TreeVisitor<ControlFlowVisitor.Result,com.google.errorprone.refaster.ControlFlowVisitor.BreakContext>
      Overrides:
      visitSwitch in class com.sun.source.util.SimpleTreeVisitor<ControlFlowVisitor.Result,com.google.errorprone.refaster.ControlFlowVisitor.BreakContext>
    • visitCase

      public ControlFlowVisitor.Result visitCase(com.sun.source.tree.CaseTree node, com.google.errorprone.refaster.ControlFlowVisitor.BreakContext cxt)
      Specified by:
      visitCase in interface com.sun.source.tree.TreeVisitor<ControlFlowVisitor.Result,com.google.errorprone.refaster.ControlFlowVisitor.BreakContext>
      Overrides:
      visitCase in class com.sun.source.util.SimpleTreeVisitor<ControlFlowVisitor.Result,com.google.errorprone.refaster.ControlFlowVisitor.BreakContext>
    • visitSynchronized

      public ControlFlowVisitor.Result visitSynchronized(com.sun.source.tree.SynchronizedTree node, com.google.errorprone.refaster.ControlFlowVisitor.BreakContext cxt)
      Specified by:
      visitSynchronized in interface com.sun.source.tree.TreeVisitor<ControlFlowVisitor.Result,com.google.errorprone.refaster.ControlFlowVisitor.BreakContext>
      Overrides:
      visitSynchronized in class com.sun.source.util.SimpleTreeVisitor<ControlFlowVisitor.Result,com.google.errorprone.refaster.ControlFlowVisitor.BreakContext>
    • visitTry

      public ControlFlowVisitor.Result visitTry(com.sun.source.tree.TryTree node, com.google.errorprone.refaster.ControlFlowVisitor.BreakContext cxt)
      Specified by:
      visitTry in interface com.sun.source.tree.TreeVisitor<ControlFlowVisitor.Result,com.google.errorprone.refaster.ControlFlowVisitor.BreakContext>
      Overrides:
      visitTry in class com.sun.source.util.SimpleTreeVisitor<ControlFlowVisitor.Result,com.google.errorprone.refaster.ControlFlowVisitor.BreakContext>
    • visitCatch

      public ControlFlowVisitor.Result visitCatch(com.sun.source.tree.CatchTree node, com.google.errorprone.refaster.ControlFlowVisitor.BreakContext cxt)
      Specified by:
      visitCatch in interface com.sun.source.tree.TreeVisitor<ControlFlowVisitor.Result,com.google.errorprone.refaster.ControlFlowVisitor.BreakContext>
      Overrides:
      visitCatch in class com.sun.source.util.SimpleTreeVisitor<ControlFlowVisitor.Result,com.google.errorprone.refaster.ControlFlowVisitor.BreakContext>
    • visitIf

      public ControlFlowVisitor.Result visitIf(com.sun.source.tree.IfTree node, com.google.errorprone.refaster.ControlFlowVisitor.BreakContext cxt)
      Specified by:
      visitIf in interface com.sun.source.tree.TreeVisitor<ControlFlowVisitor.Result,com.google.errorprone.refaster.ControlFlowVisitor.BreakContext>
      Overrides:
      visitIf in class com.sun.source.util.SimpleTreeVisitor<ControlFlowVisitor.Result,com.google.errorprone.refaster.ControlFlowVisitor.BreakContext>
    • visitExpressionStatement

      public ControlFlowVisitor.Result visitExpressionStatement(com.sun.source.tree.ExpressionStatementTree node, com.google.errorprone.refaster.ControlFlowVisitor.BreakContext cxt)
      Specified by:
      visitExpressionStatement in interface com.sun.source.tree.TreeVisitor<ControlFlowVisitor.Result,com.google.errorprone.refaster.ControlFlowVisitor.BreakContext>
      Overrides:
      visitExpressionStatement in class com.sun.source.util.SimpleTreeVisitor<ControlFlowVisitor.Result,com.google.errorprone.refaster.ControlFlowVisitor.BreakContext>
    • visitLabeledStatement

      public ControlFlowVisitor.Result visitLabeledStatement(com.sun.source.tree.LabeledStatementTree node, com.google.errorprone.refaster.ControlFlowVisitor.BreakContext cxt)
      Specified by:
      visitLabeledStatement in interface com.sun.source.tree.TreeVisitor<ControlFlowVisitor.Result,com.google.errorprone.refaster.ControlFlowVisitor.BreakContext>
      Overrides:
      visitLabeledStatement in class com.sun.source.util.SimpleTreeVisitor<ControlFlowVisitor.Result,com.google.errorprone.refaster.ControlFlowVisitor.BreakContext>
    • visitBreak

      public ControlFlowVisitor.Result visitBreak(com.sun.source.tree.BreakTree node, com.google.errorprone.refaster.ControlFlowVisitor.BreakContext cxt)
      Specified by:
      visitBreak in interface com.sun.source.tree.TreeVisitor<ControlFlowVisitor.Result,com.google.errorprone.refaster.ControlFlowVisitor.BreakContext>
      Overrides:
      visitBreak in class com.sun.source.util.SimpleTreeVisitor<ControlFlowVisitor.Result,com.google.errorprone.refaster.ControlFlowVisitor.BreakContext>
    • visitContinue

      public ControlFlowVisitor.Result visitContinue(com.sun.source.tree.ContinueTree node, com.google.errorprone.refaster.ControlFlowVisitor.BreakContext cxt)
      Specified by:
      visitContinue in interface com.sun.source.tree.TreeVisitor<ControlFlowVisitor.Result,com.google.errorprone.refaster.ControlFlowVisitor.BreakContext>
      Overrides:
      visitContinue in class com.sun.source.util.SimpleTreeVisitor<ControlFlowVisitor.Result,com.google.errorprone.refaster.ControlFlowVisitor.BreakContext>
    • visitReturn

      public ControlFlowVisitor.Result visitReturn(com.sun.source.tree.ReturnTree node, com.google.errorprone.refaster.ControlFlowVisitor.BreakContext cxt)
      Specified by:
      visitReturn in interface com.sun.source.tree.TreeVisitor<ControlFlowVisitor.Result,com.google.errorprone.refaster.ControlFlowVisitor.BreakContext>
      Overrides:
      visitReturn in class com.sun.source.util.SimpleTreeVisitor<ControlFlowVisitor.Result,com.google.errorprone.refaster.ControlFlowVisitor.BreakContext>
    • visitThrow

      public ControlFlowVisitor.Result visitThrow(com.sun.source.tree.ThrowTree node, com.google.errorprone.refaster.ControlFlowVisitor.BreakContext cxt)
      Specified by:
      visitThrow in interface com.sun.source.tree.TreeVisitor<ControlFlowVisitor.Result,com.google.errorprone.refaster.ControlFlowVisitor.BreakContext>
      Overrides:
      visitThrow in class com.sun.source.util.SimpleTreeVisitor<ControlFlowVisitor.Result,com.google.errorprone.refaster.ControlFlowVisitor.BreakContext>