blob: 2ecdaa5748ea4b6e6e233eea0c94f370fdfedc8e (
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
|
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
/**
* This test is exploring situations where an if() pointcut is used with a parameter
* and yet a reference pointcut referring to it is not binding the parameter.
*/
public class D {
public static void main(String []argv) {
new D().run();
}
public void run() {
System.out.println("D.run() executing");
}
public boolean isTrue() {
return true;
}
}
@Aspect class Azpect {
@Pointcut("this(d) && if()") public static boolean method(D d) { return d.isTrue(); }
@Before("method(*) && execution(* D.run(..))") public void beforeAdvice() {
System.out.println("advice running");
}
}
|