blob: 446bf59f1a1441ed130e78b015abba9f3a0194b8 (
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
|
import org.aspectj.testing.Tester;
public class PointcutQualification {
public static void main(String[] args) {
Tester.expectEvent("before pc_reference");
new TargetClass().doit();
Tester.checkAllEvents();
}
}
class I {
public static final void got(String s) {
Tester.event(s);
}
}
class TargetClass{ void doit(){}}
aspect DebugAspect { // incorrect compiler error here
before() : Aspect.pc_reference() { I.got("before pc_reference");}
}
aspect Aspect {
pointcut pc_notfound()
: execution(void TargetClass.doit()) ;
pointcut someCallCflow()
: !within(Aspect) && !within(DebugAspect) && !within(I)
//&& cflow(Aspect.pc_notfound()) ; // workaround
&& cflow(pc_notfound()) ; // bug: unqualified reference in DebugAspect context
pointcut pc_reference() : someCallCflow();
}
|