Skip to content

Commit 84ec453

Browse files
committed
Explicitly rule out switchCaseControls for PatternCase
1 parent 77b1721 commit 84ec453

File tree

1 file changed

+2
-0
lines changed
  • java/ql/lib/semmle/code/java/controlflow

1 file changed

+2
-0
lines changed

java/ql/lib/semmle/code/java/controlflow/Guards.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,8 @@ class Guard extends ExprParent {
258258

259259
private predicate switchCaseControls(SwitchCase sc, BasicBlock bb) {
260260
exists(BasicBlock caseblock |
261+
// Pattern cases are handled as condition blocks
262+
not sc instanceof PatternCase and
261263
caseblock.getFirstNode() = sc.getControlFlowNode() and
262264
caseblock.bbDominates(bb) and
263265
// Check we can't fall through from a previous block:

0 commit comments

Comments
 (0)