aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs/CflowBinding.java
blob: f127811d99c31b8c4164c356430a78c3fccd57b3 (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
// for Bugzilla Bug 34858  
//   Weaver crash w/ coverage

import org.aspectj.testing.Tester;

public class CflowBinding {
	public static void main(String[] args) {
		new Bar().bar(10);
	}
	
	
	static aspect A {
		pointcut flow(int i, Object o): cflow(execution(void bar(int)) && this(o) && args(i));
		
		Object around() : call(void m()) && flow(int, Object) {
			return proceed();
		}
		
		Object around(final int i) : call(void m()) && flow(i, Object) {
			System.out.println("i: " + i);
			return proceed(i);
		}
		
		Object around(final Object o) : call(void m()) && flow(int, o) {
			System.out.println("o: " + o);
			return proceed(o);
		}
		
		Object around(final Object o, final int i) : call(void m()) && flow(i, o) {
			System.out.println("o: " + o + ", i: " + i);
			return proceed(o, i);
		}
	}
}

class Bar {
	void bar(int i) {
		m();
	}
	void m() {
		System.out.println("m");
	}
}