KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > methodresolver > p1 > TypeForTraverser


1 /*******************************************************************************
2  * Copyright (c) 2006 Mountainminds GmbH & Co. KG
3  * This software is provided under the terms of the Eclipse Public License v1.0
4  * See http://www.eclipse.org/legal/epl-v10.html.
5  *
6  * $Id: TypeForTraverser.java 194 2006-12-14 23:11:46Z mtnminds $
7  ******************************************************************************/

8 package methodresolver.p1;
9
10 /**
11  * Test type for TypeTraverser.
12  *
13  * @author Marc R. Hoffmann
14  * @version $Revision: 194 $
15  */

16 public class TypeForTraverser {
17
18   public static void doit() {
19   }
20
21   // Nested class with anonymous inner class
22

23   static class InnerA {
24     public void test() {
25       new Runnable JavaDoc() {
26         public void run() {
27           doit();
28         }
29       };
30     }
31   }
32
33   // Anonymous class with named inner class:
34

35   static {
36     new Runnable JavaDoc() {
37       class InnerB {
38         public void test() {
39           doit();
40         }
41       }
42
43       public void run() {
44         new InnerB().test();
45       }
46     }.run();
47   }
48
49   // Another anonymous class with named inner class:
50

51   static {
52     new Runnable JavaDoc() {
53       class InnerC {
54         public void test() {
55           doit();
56         }
57       }
58
59       public void run() {
60         new InnerC().test();
61       }
62     }.run();
63   }
64
65   // Member Initializer with anonymous class:
66

67   public Object JavaDoc member1 = new Runnable JavaDoc() {
68     public void run() {
69       doit();
70     }
71   };
72
73   // Method with anonymous class:
74

75   public void test() {
76     Runnable JavaDoc r = new Runnable JavaDoc() {
77       public void run() {
78         doit();
79       }
80     };
81     r.run();
82   };
83
84   public static void main(String JavaDoc[] args) {
85
86   }
87
88 }
89
Popular Tags