blob: b918c8fade492fa18b201c1990240627e10a55d6 (
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
|
import org.aspectj.testing.Tester;
import org.aspectj.testing.Tester;
public class CflowAlone {
public static void main(String[] args){
new testclass1();
Tester.check(0 < Filteraspect.i,
"0 < Filteraspect.i: " + Filteraspect.i);
}
}
class testclass1 {}
class testclass2 {}
aspect Filteraspect {
static int i;
// all these variants fail
//pointcut goCut(): cflow(this(testclass2));
//pointcut goCut(): cflow(target(testclass2));
//pointcut goCut(): cflow(args(testclass2));
//pointcut goCut(): cflow(!within(FilterAspect));
//pointcut goCut(): cflow(within(FilterAspect));
//pointcut goCut(): cflow(within(testclass1));
pointcut goCut(): !within(Filteraspect) && cflow(within(testclass1))
&& !preinitialization(new(..)) && !initialization(new(..));
// works ok
//pointcut goCut(): within(Filteraspect);
Object around(): goCut() { i++; return proceed(); }
// no bug when using before or after
//after(): goCut() { int i = 1; System.getProperties().put("foo", "bar");}
}
|