aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs/SwitchInAround.java
blob: c86d71a3c12537146820b176588896d6e25f6e74 (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
import org.aspectj.testing.Tester;

public class SwitchInAround {
	public static void main(String[] args) {
		SwitchInAround o = new SwitchInAround();
		Tester.checkEqual(o.doit(1), "1");
		Tester.checkEqual(o.doit(2), "2");
		Tester.checkEqual(o.doit(3), "default");
	}
	
	public String doit(int i) {
		return "doit";
	}
}

privileged aspect A {
	String around(int index): args(index) && call(String doit(int)) {
		switch(index) {
			case 1:
				return "1";
			case 2:
				return "2";
			default:
				return "default";
		}
	}
}