1
2 package uk.co.badgersinfoil.cvprof.example;
3
4 /**
5 * Tests cvprof's ability to handle multiple class definitions in a single
6 * source file. In addition to the main class defined, 'MultiClassTest', there
7 * is the non-static inner class 'MultiClassTest.InnerClazz', an anonymous
8 * implementation of the Runnable interface, and a second, package-private
9 * class defined at the top level, 'TopLevel'
10 */
|
11 public class MultiClassTest {
|
12 public static void test() {
|
13 MultiClassTest me = new MultiClassTest();
14 InnerClazz inner = me.new InnerClazz();
15 inner.sayHello();
|
16
|
17 Runnable anon = new Runnable() {
18 public void run() {
19 int i = 1;
20 double j = Math.random();
21 String k = i+"<>"+j;
22 }
|
23 };
24
|
25 anon.run();
26 }
|
27
|
28 private class InnerClazz {
|
29 public void sayHello() {
|
30 TopLevel other = new TopLevel();
|
31
|
32 TopLevel.blah(4);
33 }
|
34 }
35 }
36
|
37 class TopLevel {
|
38 public static String blah(int i) {
|
39 return i>0 ? "."+blah(i-1) : "!";
|
40 }
41 }
|