summaryrefslogtreecommitdiffstats
path: root/tests/new/TwoAnonymous.java
blob: 09489cef117ff6ffd3c3bf155c716b38c7423793 (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
34
35
36
37
38
39
40
41
42
43
44
45
public class TwoAnonymous {
    /**/
    Runnable i = new Runnable() {
	    public void run() {
		System.out.println("i");
	    }
	    private Object foo() { return null; }
	};
    Runnable j = new Runnable() {
	    public void run() { 
		System.out.println(new Integer(0));
	    }
	};
    /**/
    public static void main(String[] args) {
	Runnable k = new Runnable() {
                int x = 0;
		public void run() {
		    System.out.println("k");
                    x = 4;
	    }
		private Object foo() { return null; }
	    };

        Runnable k1 = new Runnable() { public void run() { } };

	k.run();
		
    }
}

aspect A {

    before(Runnable r): call(void Runnable.run()) && target(r) {
	System.out.println("calling run: " + r + ", " + thisJoinPoint.getArgs() +", " + thisJoinPoint.getTarget());
    }

    after() returning(Runnable r): call(Runnable+.new()) {
	System.out.println("new runnable: " + r);
    }

    before(): set(int x) {
        System.out.println("setting x");
    }
}