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 voidaddExitSuccessor(CFG.Block block)voidaddFalseSuccessor(CFG.Block successor)voidaddTrueSuccessor(CFG.Block successor)CaseGroupTreecaseGroup()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.BlockexitBlock()CFG.BlockfalseBlock()intid()booleanisCatchBlock()booleanisFinallyBlock()booleanisInactive()booleanisMethodExitBlock()Set<CFG.Block>predecessors()voidsetCaseGroup(CaseGroupTree caseGroup)Set<CFG.Block>successors()CFG.BlocksuccessorWithoutJump()This method makes the implementation of RSPEC-3626 almost trivial.Treeterminator()CFG.BlocktrueBlock()
-
-
-
Method Detail
-
id
public int id()
- Specified by:
idin interfaceCFG.IBlock<Tree>- Specified by:
idin interfaceControlFlowGraph.Block
-
elements
public List<Tree> elements()
- Specified by:
elementsin interfaceCFG.IBlock<Tree>- Specified by:
elementsin 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:
successorsin interfaceCFG.IBlock<Tree>- Specified by:
successorsin interfaceControlFlowGraph.Block
-
terminator
@CheckForNull public Tree terminator()
- Specified by:
terminatorin interfaceCFG.IBlock<Tree>- Specified by:
terminatorin 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)
-
-