Skip to content

Commit c46b54b

Browse files
yo-hsmowton
authored andcommitted
Java 17: exclude non-source locations in some tests
1 parent 0bf7e07 commit c46b54b

File tree

5 files changed

+22
-4
lines changed

5 files changed

+22
-4
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
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
import semmle.code.java.Expr
22

3+
class SrcFloatingPointLiteral extends FloatLiteral {
4+
SrcFloatingPointLiteral() {
5+
this.getCompilationUnit().fromSource()
6+
}
7+
}
8+
39
from FloatLiteral lit
410
select lit, lit.getValue(), lit.getFloatValue()
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
import semmle.code.java.Expr
22

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

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

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

3-
from Literal l
3+
class SrcLiteral extends Literal {
4+
SrcLiteral() {
5+
this.getCompilationUnit().fromSource()
6+
}
7+
}
8+
9+
from SrcLiteral l
410
where
511
l instanceof IntegerLiteral or
612
l instanceof LongLiteral or

0 commit comments

Comments
 (0)