Package org.sonar.java.cfg
Class CFG.Block
- java.lang.Object
-
- org.sonar.java.cfg.CFG.Block
-
- All Implemented Interfaces:
CFG.IBlock<Tree>
,ControlFlowGraph.Block
- Enclosing class:
- CFG
public static class CFG.Block extends Object implements CFG.IBlock<Tree>, ControlFlowGraph.Block
-
-
Field Summary
Fields Modifier and Type Field Description static Predicate<CFG.Block>
IS_CATCH_BLOCK
-
Constructor Summary
Constructors Constructor Description Block(int id)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addExitSuccessor(CFG.Block block)
void
addFalseSuccessor(CFG.Block successor)
void
addTrueSuccessor(CFG.Block successor)
CaseGroupTree
caseGroup()
Label is used to contain additional information about a block which is not directly related to CFG structure.List<Tree>
elements()
Set<CFG.Block>
exceptions()
CFG.Block
exitBlock()
CFG.Block
falseBlock()
int
id()
boolean
isCatchBlock()
boolean
isFinallyBlock()
boolean
isInactive()
boolean
isMethodExitBlock()
Set<CFG.Block>
predecessors()
void
setCaseGroup(CaseGroupTree caseGroup)
Set<CFG.Block>
successors()
CFG.Block
successorWithoutJump()
This method makes the implementation of RSPEC-3626 almost trivial.Tree
terminator()
CFG.Block
trueBlock()
-
-
-
Method Detail
-
id
public int id()
- Specified by:
id
in interfaceCFG.IBlock<Tree>
- Specified by:
id
in interfaceControlFlowGraph.Block
-
elements
public List<Tree> elements()
- Specified by:
elements
in interfaceCFG.IBlock<Tree>
- Specified by:
elements
in interfaceControlFlowGraph.Block
-
trueBlock
public CFG.Block trueBlock()
-
falseBlock
public CFG.Block falseBlock()
-
exitBlock
public CFG.Block exitBlock()
-
isFinallyBlock
public boolean isFinallyBlock()
-
isCatchBlock
public boolean isCatchBlock()
-
addTrueSuccessor
public void addTrueSuccessor(CFG.Block successor)
-
addFalseSuccessor
public void addFalseSuccessor(CFG.Block successor)
-
addExitSuccessor
public void addExitSuccessor(CFG.Block block)
-
successors
public Set<CFG.Block> successors()
- Specified by:
successors
in interfaceCFG.IBlock<Tree>
- Specified by:
successors
in interfaceControlFlowGraph.Block
-
terminator
@CheckForNull public Tree terminator()
- Specified by:
terminator
in interfaceCFG.IBlock<Tree>
- Specified by:
terminator
in interfaceControlFlowGraph.Block
-
isInactive
public boolean isInactive()
-
isMethodExitBlock
public boolean isMethodExitBlock()
-
successorWithoutJump
@CheckForNull public CFG.Block successorWithoutJump()
This method makes the implementation of RSPEC-3626 almost trivial.- Returns:
- the block which would be the successor of this one if this one didn't terminate with a jump
-
caseGroup
@CheckForNull public CaseGroupTree caseGroup()
Label is used to contain additional information about a block which is not directly related to CFG structure. Used for simplifying implementation of RSPEC-128.
-
setCaseGroup
public void setCaseGroup(CaseGroupTree caseGroup)
-
-