blob: 5abe6a7afd16f30ca9f0595e6a2d9748d042f033 (
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.testing.Tester;
public class TryErrors {
public static void main(String[] args) {
test();
}
public static void test() {
Foo foo = new Foo();
foo.bar();
Tester.check(foo.memberAdvised, "member advice happened");
Tester.check(foo.signatureAdvised, "signature advice happened");
}
}
class Foo {
boolean memberAdvised = false;
boolean signatureAdvised = false;
public void bar() {
;
}
}
aspect A {
/*static*/ after(Foo foo): target(foo) && within(Foo) && execution(void bar()) {
foo.memberAdvised = true;
}
/*static*/ before(Foo foo): target(foo) && call(void bar()) {
foo.signatureAdvised = true;
}
}
|