Skip to content

Commit cc8e980

Browse files
authored
Merge pull request #10009 from smowton/smowton/java17-options
Java: Adapt tests as required by JDK17 extractor upgrade
2 parents 56fddd7 + 341241c commit cc8e980

File tree

16 files changed

+29
-17
lines changed

16 files changed

+29
-17
lines changed

java/ql/test/library-tests/dataflow/modulus-analysis/ModulusAnalysis.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ import semmle.code.java.dataflow.ModulusAnalysis
33
import semmle.code.java.dataflow.Bound
44

55
from Expr e, Bound b, int delta, int mod
6-
where exprModulus(e, b, delta, mod)
6+
where exprModulus(e, b, delta, mod) and e.getCompilationUnit().fromSource()
77
select e, b.toString(), delta, mod

java/ql/test/library-tests/dataflow/range-analysis/RangeAnalysis.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ private string getDirectionString(boolean d) {
88
}
99

1010
from Expr e, Bound b, int delta, boolean upper, Reason reason
11-
where bounded(e, b, delta, upper, reason)
11+
where bounded(e, b, delta, upper, reason) and e.getCompilationUnit().fromSource()
1212
select e, b.toString(), delta, getDirectionString(upper), reason

java/ql/test/library-tests/literals/booleanLiterals/booleanLiterals.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
| BooleanLiterals.java:5:3:5:6 | true | true | true |
22
| BooleanLiterals.java:6:3:6:7 | false | false | false |
3-
| BooleanLiterals.java:8:8:8:26 | 4\\u0072\\u0075\\u0065 | true | true |
3+
| BooleanLiterals.java:8:3:8:26 | \\u0074\\u0072\\u0075\\u0065 | true | true |
44
| BooleanLiterals.java:13:3:13:6 | true | true | true |
55
| BooleanLiterals.java:13:11:13:14 | true | true | true |
66
| BooleanLiterals.java:14:3:14:7 | false | false | false |

java/ql/test/library-tests/literals/charLiterals/charLiterals.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
| CharLiterals.java:18:3:18:10 | '\\uDC00' | \ufffd | 56320 |
1414
| CharLiterals.java:20:3:20:16 | '\\u005C\\u005C' | \\ | 92 |
1515
| CharLiterals.java:21:3:21:16 | '\\u005C\\u0027' | ' | 39 |
16-
| CharLiterals.java:22:8:22:15 | 7a\\u0027 | a | 97 |
16+
| CharLiterals.java:22:3:22:15 | \\u0027a\\u0027 | a | 97 |
1717
| CharLiterals.java:27:4:27:6 | 'a' | a | 97 |
1818
| CharLiterals.java:28:4:28:6 | 'a' | a | 97 |
1919
| CharLiterals.java:33:3:33:5 | 'a' | a | 97 |

java/ql/test/library-tests/literals/doubleLiterals/doubleLiterals.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
| DoubleLiterals.java:17:3:17:10 | 4.9e-324 | 4.9E-324 | 4.9E-324 |
1313
| DoubleLiterals.java:18:3:18:28 | 0x0.0_0000_0000_0001P-1022 | 4.9E-324 | 4.9E-324 |
1414
| DoubleLiterals.java:19:3:19:13 | 0x1.0P-1074 | 4.9E-324 | 4.9E-324 |
15-
| DoubleLiterals.java:21:8:21:20 | 0\\u002E\\u0030 | 0.0 | 0.0 |
15+
| DoubleLiterals.java:21:3:21:20 | \\u0030\\u002E\\u0030 | 0.0 | 0.0 |
1616
| DoubleLiterals.java:26:4:26:6 | 0.0 | 0.0 | 0.0 |
1717
| DoubleLiterals.java:27:4:27:6 | 0.0 | 0.0 | 0.0 |
1818
| DoubleLiterals.java:28:4:28:6 | 1.0 | 1.0 | 1.0 |

java/ql/test/library-tests/literals/floatLiterals/floatLiterals.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
| FloatLiterals.java:16:3:16:10 | 1.4e-45f | 1.4E-45 | 1.4E-45 |
1212
| FloatLiterals.java:17:3:17:18 | 0x0.000002P-126f | 1.4E-45 | 1.4E-45 |
1313
| FloatLiterals.java:18:3:18:13 | 0x1.0P-149f | 1.4E-45 | 1.4E-45 |
14-
| FloatLiterals.java:20:8:20:26 | 0\\u002E\\u0030\\u0066 | 0.0 | 0.0 |
14+
| FloatLiterals.java:20:3:20:26 | \\u0030\\u002E\\u0030\\u0066 | 0.0 | 0.0 |
1515
| FloatLiterals.java:25:4:25:6 | 0.f | 0.0 | 0.0 |
1616
| FloatLiterals.java:26:4:26:6 | 0.f | 0.0 | 0.0 |
1717
| FloatLiterals.java:27:4:27:7 | 1.0f | 1.0 | 1.0 |
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
import semmle.code.java.Expr
22

3-
from FloatLiteral lit
3+
class SrcFloatingPointLiteral extends FloatLiteral {
4+
SrcFloatingPointLiteral() { this.getCompilationUnit().fromSource() }
5+
}
6+
7+
from SrcFloatingPointLiteral lit
48
select lit, lit.getValue(), lit.getFloatValue()

java/ql/test/library-tests/literals/integerLiterals/integerLiterals.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
| IntegerLiterals.java:23:3:23:13 | 0xffff_ffff | -1 | -1 |
1919
| IntegerLiterals.java:24:3:24:16 | 0377_7777_7777 | -1 | -1 |
2020
| IntegerLiterals.java:25:3:25:43 | 0b1111_1111_1111_1111_1111_1111_1111_1111 | -1 | -1 |
21-
| IntegerLiterals.java:27:8:27:8 | 0 | 0 | 0 |
21+
| IntegerLiterals.java:27:3:27:8 | \\u0030 | 0 | 0 |
2222
| IntegerLiterals.java:32:4:32:4 | 0 | 0 | 0 |
2323
| IntegerLiterals.java:33:4:33:4 | 0 | 0 | 0 |
2424
| IntegerLiterals.java:34:4:34:4 | 1 | 1 | 1 |
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
import semmle.code.java.Expr
22

3-
from IntegerLiteral lit
3+
class SrcIntegerLiteral extends IntegerLiteral {
4+
SrcIntegerLiteral() { this.getCompilationUnit().fromSource() }
5+
}
6+
7+
from SrcIntegerLiteral lit
48
select lit, lit.getValue(), lit.getIntValue()

java/ql/test/library-tests/literals/literals-numeric/negativeNumericLiterals.ql

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import java
22

3-
from Literal l
3+
class SrcLiteral extends Literal {
4+
SrcLiteral() { this.getCompilationUnit().fromSource() }
5+
}
6+
7+
from SrcLiteral l
48
where
59
l instanceof IntegerLiteral or
610
l instanceof LongLiteral or

0 commit comments

Comments
 (0)