blob: b2e971845c6db8004f074c4475efab201b98cf87 (
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
|
import org.aspectj.testing.Tester;
public class Driver {
public static void main(String[] args) { test(); }
public static void test() {
Foo foo = new Foo();
foo.m();
}
}
aspect A {
//static advice(): Foo && (void m(..) || new(..)) {
//!!!no around advice allowed on constructors right now
void around(): target(Foo) && call(void m(..)) {
class Internal {
int val() { return 1; }
}
int i = 1;
Internal j = new Internal();
proceed();
Tester.checkEqual(i, 1, "i");
Tester.checkEqual(j.val(), 1, "j.val()");
}
}
class Foo {
Foo() {
// System.out.println("constructor Foo()");
}
void m() {
// System.out.println("method m()");
}
}
|