diff --git a/java/ql/src/semmle/code/java/Statement.qll b/java/ql/src/semmle/code/java/Statement.qll index 2dfa5d26456..2f98615b243 100755 --- a/java/ql/src/semmle/code/java/Statement.qll +++ b/java/ql/src/semmle/code/java/Statement.qll @@ -427,7 +427,7 @@ class SwitchCase extends Stmt, @case { * Gets the expression of the surrounding switch that this case is compared * against. */ - Expr getTestExpr() { + Expr getSelectorExpr() { result = this.getSwitch().getExpr() or result = this.getSwitchExpr().getExpr() } diff --git a/java/ql/src/semmle/code/java/controlflow/Guards.qll b/java/ql/src/semmle/code/java/controlflow/Guards.qll index 976f90c17b1..ac7d4cb8150 100644 --- a/java/ql/src/semmle/code/java/controlflow/Guards.qll +++ b/java/ql/src/semmle/code/java/controlflow/Guards.qll @@ -127,7 +127,7 @@ class Guard extends ExprParent { branch = true and bb2.getFirstNode() = sc.getControlFlowNode() and pred = sc.getControlFlowNode().getAPredecessor() and - pred.(Expr).getParent*() = sc.getTestExpr() and + pred.(Expr).getParent*() = sc.getSelectorExpr() and bb1 = pred.getBasicBlock() ) or @@ -161,12 +161,12 @@ class Guard extends ExprParent { } private predicate switchCaseControls(SwitchCase sc, BasicBlock bb) { - exists(BasicBlock caseblock, Expr switchTest | - switchTest = sc.getTestExpr() and + exists(BasicBlock caseblock, Expr selector | + selector = sc.getSelectorExpr() and caseblock.getFirstNode() = sc.getControlFlowNode() and caseblock.bbDominates(bb) and forall(ControlFlowNode pred | pred = sc.getControlFlowNode().getAPredecessor() | - pred.(Expr).getParent*() = switchTest + pred.(Expr).getParent*() = selector ) ) } @@ -255,7 +255,7 @@ private predicate equalityGuard(Guard g, Expr e1, Expr e2, boolean polarity) { exists(ConstCase cc | cc = g and polarity = true and - cc.getTestExpr().getProperExpr() = e1 and + cc.getSelectorExpr().getProperExpr() = e1 and cc.getValue() = e2 and strictcount(cc.getValue(_)) = 1 )