Skip to content

Commit cd22bb3

Browse files
committed
Java: Add another test case.
1 parent 0ae81ea commit cd22bb3

File tree

1 file changed

+21
-0
lines changed
  • java/ql/test/library-tests/dataflow/capture

1 file changed

+21
-0
lines changed

java/ql/test/library-tests/dataflow/capture/B.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,4 +227,25 @@ void testEnhancedForStmtCapture() {
227227
}
228228
}
229229

230+
void testDoubleCall() {
231+
String s = source("src");
232+
List<String> l = new ArrayList<>();
233+
List<String> l2 = new ArrayList<>();
234+
class MyLocal2 {
235+
MyLocal2() {
236+
sink(l.get(0)); // no flow
237+
sink(l2.get(0)); // no flow
238+
l.add(s);
239+
}
240+
void run() {
241+
l2.add(l.get(0));
242+
}
243+
}
244+
// The ClassInstanceExpr has two calls in the same cfg node:
245+
// First the constructor call for which it is the postupdate,
246+
// and then as instance argument to the run call.
247+
new MyLocal2().run();
248+
sink(l.get(0)); // $ hasValueFlow=src
249+
sink(l2.get(0)); // $ hasValueFlow=src
250+
}
230251
}

0 commit comments

Comments
 (0)