blob: 3036bcac90e419610a1a237a78ee0370646cdeaa (
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
|
import org.aspectj.testing.Tester;
public class InterfaceInitializerOrder {
public static void main(String[] args) {
Base base = new Base();
Tester.checkEqual(InitAspect.inits.toString(), "Super1,Super2,SuperInterface,Base,");
}
}
class Super1 {}
class Super2 extends Super1 {}
interface SuperInterface {}
class Base extends Super2 implements SuperInterface { }
aspect InitAspect {
public static StringBuffer inits = new StringBuffer();
pointcut outerMatch() : initialization(new(..)) && !within(InitAspect);
before() : outerMatch() {
inits.append(thisJoinPoint.getSignature().getDeclaringType().getName());
inits.append(",");
}
}
|