aboutsummaryrefslogtreecommitdiffstats
path: root/org.aspectj.ajdt.core/testdata/src1/AroundA1.java
blob: 8230a80e05501ce75d90ea787b7fac9e1dc6392d (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 AroundA1 {
	
	public static void main(String[] args) {
		System.err.println(new AroundA1().main(3, (short)1, true));
	}
	
	public int main(int xx, short s, boolean yy) {
		System.err.println(xx);
		System.err.println(s);
		System.err.println(yy);
		return 10;
	}
}		

aspect MyAroundAspect {
	int field = 10;
	
	pointcut foo(): call(int main(..));
	
	Object around(AroundA1 o, int i, boolean b): target(o) && args(i, *, b) && foo() {
		System.err.println("enter: " + o + " with " + field);
		Object x = proceed(o, 10, false);
		System.err.println("got: " + x);
		return new Integer(42);
	}
	
	
//	void around(Object a): args(a) && foo() {
//		System.out.println("enter");
//		proceed("new: " + a);
//		System.out.println("exit");
//	}
//	
//	void around(final String[] a): args(a) && foo() {
//		Runnable r = new Runnable() {
//			public void run() {
//				proceed(a);
//			}
//		};
//		r.run();
//		r.run();
//	}
}