Java 17: exclude non-source locations in some tests

This commit is contained in:
yo-h
2021-11-26 17:22:05 -05:00
parent 34b3c0863c
commit 2e24f39d5f
5 changed files with 22 additions and 4 deletions

View File

@@ -3,5 +3,5 @@ import semmle.code.java.dataflow.ModulusAnalysis
import semmle.code.java.dataflow.Bound
from Expr e, Bound b, int delta, int mod
where exprModulus(e, b, delta, mod)
where exprModulus(e, b, delta, mod) and e.getCompilationUnit().fromSource()
select e, b.toString(), delta, mod

View File

@@ -8,5 +8,5 @@ private string getDirectionString(boolean d) {
}
from Expr e, Bound b, int delta, boolean upper, Reason reason
where bounded(e, b, delta, upper, reason)
where bounded(e, b, delta, upper, reason) and e.getCompilationUnit().fromSource()
select e, b.toString(), delta, getDirectionString(upper), reason

View File

@@ -1,4 +1,10 @@
import semmle.code.java.Expr
class SrcFloatingPointLiteral extends FloatingPointLiteral {
SrcFloatingPointLiteral() {
this.getCompilationUnit().fromSource()
}
}
from FloatingPointLiteral lit
select lit, lit.getValue(), lit.getFloatValue()

View File

@@ -1,4 +1,10 @@
import semmle.code.java.Expr
from IntegerLiteral lit
class SrcIntegerLiteral extends IntegerLiteral {
SrcIntegerLiteral() {
this.getCompilationUnit().fromSource()
}
}
from SrcIntegerLiteral lit
select lit, lit.getValue(), lit.getIntValue()

View File

@@ -1,6 +1,12 @@
import java
from Literal l
class SrcLiteral extends Literal {
SrcLiteral() {
this.getCompilationUnit().fromSource()
}
}
from SrcLiteral l
where
l instanceof IntegerLiteral or
l instanceof LongLiteral or