Class ControlFlowLogic
- java.lang.Object
-
- com.github.javaparser.symbolsolver.resolution.typeinference.ControlFlowLogic
-
public class ControlFlowLogic extends java.lang.ObjectConsider Control Flow to determine which statements are reachable. Except for the special treatment of while, do, and for statements whose condition expression has the constant value true, the values of expressions are not taken into account in the flow analysis. See JLS 14.21
-
-
Field Summary
Fields Modifier and Type Field Description private static ControlFlowLogicinstance
-
Constructor Summary
Constructors Modifier Constructor Description privateControlFlowLogic()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StatementbreakTarget(BreakStmt breakStmt)A break statement with no label attempts to transfer control to the innermost enclosing switch, while, do, or for statement of the immediately enclosing method or initializer; this statement, which is called the break target, then immediately completes normally.booleancanCompleteNormally(Statement statement)private java.util.List<TryStmt>containedTryStmts(Statement statement)private booleancontains(Statement container, Statement contained)booleancontinueADoStatement(ContinueStmt continueStmt, DoStmt doStmt)booleanexitTheStatement(BreakStmt breakStmt)A reachable break statement exits a statement if, within the break target, either there are no try statements whose try blocks contain the break statement, or there are try statements whose try blocks contain the break statement and all finally clauses of those try statements can complete normally.static ControlFlowLogicgetInstance()booleanisReachable(Statement statement)private booleanisReachableBecauseOfPosition(Statement statement)private <P extends Node>
booleanparentIs(Node node, java.lang.Class<P> parentClass)
-
-
-
Field Detail
-
instance
private static ControlFlowLogic instance
-
-
Method Detail
-
getInstance
public static ControlFlowLogic getInstance()
-
breakTarget
public Statement breakTarget(BreakStmt breakStmt)
A break statement with no label attempts to transfer control to the innermost enclosing switch, while, do, or for statement of the immediately enclosing method or initializer; this statement, which is called the break target, then immediately completes normally. A break statement with label Identifier attempts to transfer control to the enclosing labeled statement (ยง14.7) that has the same Identifier as its label; this statement, which is called the break target, then immediately completes normally. In this case, the break target need not be a switch, while, do, or for statement.
-
exitTheStatement
public boolean exitTheStatement(BreakStmt breakStmt)
A reachable break statement exits a statement if, within the break target, either there are no try statements whose try blocks contain the break statement, or there are try statements whose try blocks contain the break statement and all finally clauses of those try statements can complete normally.
-
continueADoStatement
public boolean continueADoStatement(ContinueStmt continueStmt, DoStmt doStmt)
-
canCompleteNormally
public boolean canCompleteNormally(Statement statement)
-
isReachableBecauseOfPosition
private boolean isReachableBecauseOfPosition(Statement statement)
-
isReachable
public boolean isReachable(Statement statement)
-
-