We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 20661a3 commit a1a885eCopy full SHA for a1a885e
2 files changed
java/ql/test/library-tests/dataflow/capture/B.java
@@ -250,6 +250,7 @@ void run() {
250
}
251
252
void testInstanceInitializer() {
253
+ // Tests capture in the instance initializer ("<obinit>")
254
String s = source("init");
255
class MyLocal3 {
256
String f = s;
@@ -259,4 +260,23 @@ void run() {
259
260
261
new MyLocal3().run();
262
263
+
264
+ void testConstructorIndirection() {
265
+ // Tests capture in nested constructor call
266
+ String s = source("init");
267
+ class MyLocal4 {
268
+ String f;
269
+ MyLocal4() {
270
+ this(42);
271
+ }
272
+ MyLocal4(int i) {
273
+ f = s;
274
275
+ String get() {
276
+ return this.f;
277
278
279
+ sink(new MyLocal4().get()); // $ hasValueFlow=init
280
+ sink(new MyLocal4(1).get()); // $ hasValueFlow=init
281
282
0 commit comments