-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Expand file tree
/
Copy pathB.java
More file actions
38 lines (32 loc) · 733 Bytes
/
B.java
File metadata and controls
38 lines (32 loc) · 733 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
public class B {
public void f1() {
Elem e = new Elem();
Box1 b1 = new Box1(e, null);
Box2 b2 = new Box2(b1);
sink(b2.box1.elem1); // flow
sink(b2.box1.elem2); // no flow
}
public void f2() {
Elem e = new Elem();
Box1 b1 = new Box1(null, e);
Box2 b2 = new Box2(b1);
sink(b2.box1.elem1); // no flow
sink(b2.box1.elem2); // flow
}
public static void sink(Object o) { }
public static class Elem { }
public static class Box1 {
public Elem elem1;
public Elem elem2;
public Box1(Elem e1, Elem e2) {
this.elem1 = e1;
this.elem2 = e2;
}
}
public static class Box2 {
public Box1 box1;
public Box2(Box1 b1) {
this.box1 = b1;
}
}
}