summaryrefslogtreecommitdiffstats
path: root/tests/pureJava/NestedInners.java
blob: ed07573bf27a7543e02792fd8412437a725be3b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import org.aspectj.testing.Tester;

public class NestedInners {
    public static void main(String[] args) {
        Runnable r = new Outer().m("arg:");
        r.run();
        Tester.check("arg:varg:0");
        Tester.check("deep-arg:varg:1");
        r.run();
        Tester.check("arg:varg:2");
        Tester.check("deep-arg:varg:3");
    }
}


class Outer {
    public Runnable m(final String sarg) {
        final String svar = "v"+sarg;

        return new Runnable() {
                int counter = 0;

                public void run() {
                    Tester.note(sarg + svar+counter++);
                    new Runnable() {
                            public void run() {
                                Tester.note("deep-" + sarg + svar+counter++);
                            }
                        }.run();
                }
            };
    }
}