diff --git a/java/ql/lib/semmle/code/java/ControlFlowGraph.qll b/java/ql/lib/semmle/code/java/ControlFlowGraph.qll index a2881e62e70..4ec8ff8450a 100644 --- a/java/ql/lib/semmle/code/java/ControlFlowGraph.qll +++ b/java/ql/lib/semmle/code/java/ControlFlowGraph.qll @@ -165,8 +165,6 @@ private module Ast implements AstSig { class DefaultCase extends Case instanceof J::DefaultCase { } - predicate fallsThrough(Case c) { not c.(J::SwitchCase).isRule() } - class ConditionalExpr = J::ConditionalExpr; class BinaryExpr = J::BinaryExpr; diff --git a/shared/controlflow/codeql/controlflow/ControlFlowGraph.qll b/shared/controlflow/codeql/controlflow/ControlFlowGraph.qll index f8a4b903579..0e53ea4d93b 100644 --- a/shared/controlflow/codeql/controlflow/ControlFlowGraph.qll +++ b/shared/controlflow/codeql/controlflow/ControlFlowGraph.qll @@ -261,7 +261,7 @@ signature module AstSig { * Holds if this case can fall through to the next case if it is not * otherwise prevented with a `break` or similar. */ - default predicate fallsThrough(Case c) { none() } + default predicate fallsThrough(Case c) { not exists(c.getBody()) } /** A ternary conditional expression. */ class ConditionalExpr extends Expr {