Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d4e013b

Browse files
committed
Java 12: deprecate QL constructs for new preview feature (switch exprs)
1 parent 3870503 commit d4e013b

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

java/ql/src/semmle/code/java/Expr.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,7 @@ class ConditionalExpr extends Expr, @conditionalexpr {
10941094
}
10951095

10961096
/** A `switch` expression. */
1097-
class SwitchExpr extends Expr, @switchexpr {
1097+
deprecated class SwitchExpr extends Expr, @switchexpr {
10981098
/** Gets an immediate child statement of this `switch` expression. */
10991099
Stmt getAStmt() { result.getParent() = this }
11001100

java/ql/src/semmle/code/java/Statement.qll

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -409,10 +409,10 @@ class SwitchCase extends Stmt, @case {
409409
SwitchStmt getSwitch() { result.getACase() = this }
410410

411411
/** Gets the switch expression to which this case belongs, if any. */
412-
SwitchExpr getSwitchExpr() { result.getACase() = this }
412+
deprecated SwitchExpr getSwitchExpr() { result.getACase() = this }
413413

414414
/** Holds if this `case` is a switch labeled rule of the form `... -> ...`. */
415-
predicate isRule() {
415+
deprecated predicate isRule() {
416416
exists(Expr e | e.getParent() = this | e.getIndex() = -1)
417417
or
418418
exists(Stmt s | s.getParent() = this | s.getIndex() = -1)
@@ -427,13 +427,13 @@ class ConstCase extends SwitchCase {
427427
Expr getValue() { result.getParent() = this and result.getIndex() = 0 }
428428

429429
/** Gets the `case` constant at the specified index. */
430-
Expr getValue(int i) { result.getParent() = this and result.getIndex() = i and i >= 0 }
430+
deprecated Expr getValue(int i) { result.getParent() = this and result.getIndex() = i and i >= 0 }
431431

432432
/** Gets the expression on the right-hand side of the arrow, if any. */
433-
Expr getRuleExpression() { result.getParent() = this and result.getIndex() = -1 }
433+
deprecated Expr getRuleExpression() { result.getParent() = this and result.getIndex() = -1 }
434434

435435
/** Gets the statement on the right-hand side of the arrow, if any. */
436-
Stmt getRuleStatement() { result.getParent() = this and result.getIndex() = -1 }
436+
deprecated Stmt getRuleStatement() { result.getParent() = this and result.getIndex() = -1 }
437437

438438
/** Gets a printable representation of this statement. May include more detail than `toString()`. */
439439
override string pp() { result = "case ..." }
@@ -573,10 +573,10 @@ class BreakStmt extends Stmt, @breakstmt {
573573
predicate hasLabel() { exists(string s | s = this.getLabel()) }
574574

575575
/** Gets the value of this `break` statement, if any. */
576-
Expr getValue() { result.getParent() = this }
576+
deprecated Expr getValue() { result.getParent() = this }
577577

578578
/** Holds if this `break` statement has a value. */
579-
predicate hasValue() { exists(Expr e | e.getParent() = this) }
579+
deprecated predicate hasValue() { exists(Expr e | e.getParent() = this) }
580580

581581
/** Gets a printable representation of this statement. May include more detail than `toString()`. */
582582
override string pp() {

0 commit comments

Comments
 (0)