Skip to content

Commit 64e2f41

Browse files
committed
Java: Add test for disjunctive type in call context.
1 parent 9f20063 commit 64e2f41

File tree

1 file changed

+36
-0
lines changed
  • java/ql/test/library-tests/dataflow/callctx

1 file changed

+36
-0
lines changed

java/ql/test/library-tests/dataflow/callctx/A.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,40 @@ void test(C1 c) {
6060
new C2().wrapFoo2(source("C2.2"));
6161
wrapFoo3(new C2(), source("C2.3"));
6262
}
63+
64+
static class Sup {
65+
void wrap(Object x) {
66+
tgt(x);
67+
}
68+
69+
void tgt(Object x) {
70+
sink(x); // $ hasValueFlow=s
71+
}
72+
}
73+
74+
static class A1 extends Sup {
75+
void tgt(Object x) {
76+
sink(x); // $ hasValueFlow=s hasValueFlow=s12
77+
}
78+
}
79+
80+
static class A2 extends Sup {
81+
void tgt(Object x) {
82+
sink(x); // $ hasValueFlow=s hasValueFlow=s12
83+
}
84+
}
85+
86+
static class A3 extends Sup {
87+
void tgt(Object x) {
88+
sink(x); // $ hasValueFlow=s
89+
}
90+
}
91+
92+
void test2(Sup s) {
93+
s.wrap(source("s"));
94+
95+
if (s instanceof A1 || s instanceof A2) {
96+
s.wrap(source("s12"));
97+
}
98+
}
6399
}

0 commit comments

Comments
 (0)