OSDN Git Service

2007-03-19 Andrew Haley <aph@redhat.com>
[pf3gnuchains/gcc-fork.git] / libjava / testsuite / libjava.lang / invoke_from_inner.java
1 // This test case once showed that `f[0].execute(x)' woudln't be
2 // expanded properly, attempting to retrieve this$0 to be used in
3 // place of `f[0]'.
4
5 abstract class A {
6     abstract public void execute(C x);
7 }
8
9 class C {}
10
11 class Z extends A {
12     public void execute (C x) {
13         System.out.println ("Z.execute");
14     }
15 }
16
17 public class invoke_from_inner extends A {
18
19     Z f[] = new Z[1];
20     class D extends C {
21         D (C x) {
22             f[0].execute (x);
23             execute (x);
24         }
25     }
26     public void execute (C x) {
27       System.out.println ("invoke_from_inner.execute");
28     }
29
30     public static void main (String a[]) {
31         new invoke_from_inner().foo();
32     }
33     void foo () {
34         f[0] = new Z();
35         new D(new C());
36     }
37 }