aboutsummaryrefslogtreecommitdiffstats
path: root/org.aspectj.ajdt.core/testdata/src1/IfPcd.java
blob: 4318f3d41146d2c50880f46ce9eb02a1bb56d7a0 (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
public aspect IfPcd {
	private static int foo = 393;

	before(): execution(void IfPcd.main(..)) && if(foo == 393) {
		System.err.println("Hiya");
		foo++;
		main(null);  // saved from an infinite loop by the if
	}
	
	before(): execution(void IfPcd.main(..)) && if(thisJoinPoint.getThis() == null) {
		System.err.println("!has this: "+ thisJoinPoint.getThis());
	}
	
	before(): execution(void IfPcd.main(..)) && if(thisJoinPointStaticPart.getKind() == "method-execution") {
		System.err.println("is method-exec");
	}
	
	
	before(Object o): execution(void IfPcd.main(..)) && args(o) && if(o != null) {
		System.err.println("got: " + o);
	}
	
	pointcut fun(Object o): args(o) && if(o != null);
	
	before(Object o1, Object o2): execution(void IfPcd.main(..)) && args(o1) && fun(o2) {
		System.err.println("got: " + o2);
	}
	
	before(): execution(void IfPcd.main(..)) && fun(Object) {
		System.err.println("got nothin");
	}
	
	public static void main(String[] args) {
		System.err.println("actual body: " + args);
	}
}