File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
java/ql/test/library-tests/dataflow/capture Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments