blob: f61d360afdf73c7c3a0ef8bec3924250b4560506 (
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
|
//only register things once.
import org.aspectj.testing.Tester;
public class Driver {
public static void test() {
A a = new A();
B b = new B();
// instances of A, B are created (the instanceof Aspect isn't counted for timing reasons)
Tester.checkEqual(Aspect.count, 2, "instance count");
}
public static void main(String[] args) { test(); }
}
class A {
public A() {}
public void foo() {}
}
class B extends A {
public B() {}
public void bar() {}
}
aspect Aspect {
public static int count = 0;
after() returning(): /*target(*) &&*/ call(new()) {
count++;
}
}
|