File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
java/ql/lib/semmle/code/java/controlflow Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -217,13 +217,15 @@ class UnreachableBasicBlock extends BasicBlock {
217
217
not this instanceof CatchClause
218
218
or
219
219
// Switch statements with a constant comparison expression may have unreachable cases.
220
- exists ( ConstSwitchStmt constSwitchStmt , BasicBlock failingCaseBlock |
221
- failingCaseBlock = constSwitchStmt . getAFailingCase ( ) . getBasicBlock ( )
222
- |
220
+ exists ( ConstSwitchStmt constSwitchStmt , BasicBlock unreachableCaseBlock |
221
+ // Not accessible from the switch expression
222
+ unreachableCaseBlock = constSwitchStmt . getAFailingCase ( ) . getBasicBlock ( ) and
223
223
// Not accessible from the successful case
224
- not constSwitchStmt .getMatchingCase ( ) .getBasicBlock ( ) .getABBSuccessor * ( ) = failingCaseBlock and
225
- // Blocks dominated by the failing case block are unreachable
226
- failingCaseBlock .bbDominates ( this )
224
+ not constSwitchStmt .getMatchingCase ( ) .getBasicBlock ( ) .getABBSuccessor * ( ) =
225
+ unreachableCaseBlock
226
+ |
227
+ // Blocks dominated by an unreachable case block are unreachable
228
+ unreachableCaseBlock .bbDominates ( this )
227
229
)
228
230
}
229
231
}
You can’t perform that action at this time.
0 commit comments