mirror of
https://github.com/github/codeql.git
synced 2026-04-29 02:35:15 +02:00
Java: Add test for disjunctive type in call context.
This commit is contained in:
@@ -60,4 +60,40 @@ public class A {
|
||||
new C2().wrapFoo2(source("C2.2"));
|
||||
wrapFoo3(new C2(), source("C2.3"));
|
||||
}
|
||||
|
||||
static class Sup {
|
||||
void wrap(Object x) {
|
||||
tgt(x);
|
||||
}
|
||||
|
||||
void tgt(Object x) {
|
||||
sink(x); // $ hasValueFlow=s
|
||||
}
|
||||
}
|
||||
|
||||
static class A1 extends Sup {
|
||||
void tgt(Object x) {
|
||||
sink(x); // $ hasValueFlow=s hasValueFlow=s12
|
||||
}
|
||||
}
|
||||
|
||||
static class A2 extends Sup {
|
||||
void tgt(Object x) {
|
||||
sink(x); // $ hasValueFlow=s hasValueFlow=s12
|
||||
}
|
||||
}
|
||||
|
||||
static class A3 extends Sup {
|
||||
void tgt(Object x) {
|
||||
sink(x); // $ hasValueFlow=s
|
||||
}
|
||||
}
|
||||
|
||||
void test2(Sup s) {
|
||||
s.wrap(source("s"));
|
||||
|
||||
if (s instanceof A1 || s instanceof A2) {
|
||||
s.wrap(source("s12"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user