Bug fix of inner class: only add LIVE local variables that are referred to in an...
[IRC.git] / Robust / src / Tests / inner.java
1 public class inner extends innerp {
2   int outer;
3   int f2;
4
5   public inner() {
6     super.outer=31;
7   }
8
9   public static void main(String x[]) {
10     inner i=new inner();
11     i.dotest();
12   }
13
14   public void dotest() {
15     outer=35;
16     outerprint();
17     t tmp=new t();
18     tmp.print();
19     outerAnonymousInner(100);
20   }
21   
22   public void outerprint() {
23       System.out.println("Outer class print: " + this.outer + "; " + this.f2);
24   }
25   
26   public void outerprintInnerp(innerCallback c) {
27       c.call();
28   }
29   
30   public void outerAnonymousInner(final int value) {
31       int j = 0; // this should not be included into the following anonymous inner class
32       this.outerprintInnerp(new innerCallback() {
33           public void call() {
34               System.out.println("innerCallback: " + value);
35           }
36       });
37   }
38
39   public class t extends innerpt {
40     int outer;
41     int f3;
42     public t() {
43       t.this.outer=4;
44       f1=2;
45       f2=3;
46       f3=4;
47
48     }
49
50     public void print() {
51       //should print 4 0 35
52       System.out.println("\t Inner class print: ");
53       System.out.println(outer);
54       System.out.println(super.outer);
55       t.super.outer = 1;
56       System.out.println(outer);
57       System.out.println(t.super.outer);
58       System.out.println(inner.this.outer);
59       System.out.println(inner.super.outer);
60       System.out.println(f1);
61       System.out.println(f2);
62       System.out.println(f3);
63       outerprint();
64     }
65   }
66
67 }