a short, clear example that definite reachability will improve the analysis of
[IRC.git] / Robust / src / Tests / disjoint / definite / test.java
1 public class Foo {
2   public Foo f;
3   public Foo g;
4 }
5
6 public class Test {
7
8   
9
10   static public void main( String args[] ) {
11     
12     Foo x = getFlagged();
13     Foo y = getUnflagged();
14     x.f = y;
15
16     // x is flagged and y is reachable from
17     // at most one object from that site
18     genreach y0;
19
20     Foo t = getFlagged();
21     t = getFlagged();
22
23     // x is flagged and y is reachable from
24     // at most one object from that site, even
25     // though x is summarized now
26     genreach y1;
27
28     x.g = y;
29
30     // if we had definite reachability analysis
31     // we would realize y is already reachable
32     // from x, but we don't and x is summarized
33     // so we conservatively increase the arity
34     // of objects y is reachable from.
35     genreach y2;
36
37
38     //gendefreach yo;
39     System.out.println( x+","+y );
40   }
41
42   static public Foo getFlagged() {
43     return disjoint jupiter new Foo();
44   }
45
46   static public Foo getUnflagged() {
47     return new Foo();
48   }
49
50 }