You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

InterfaceInitializerOrder.java 660B

1234567891011121314151617181920212223242526
  1. import org.aspectj.testing.Tester;
  2. public class InterfaceInitializerOrder {
  3. public static void main(String[] args) {
  4. Base base = new Base();
  5. Tester.checkEqual(InitAspect.inits.toString(), "Super1,Super2,SuperInterface,Base,");
  6. }
  7. }
  8. class Super1 {}
  9. class Super2 extends Super1 {}
  10. interface SuperInterface {}
  11. class Base extends Super2 implements SuperInterface { }
  12. aspect InitAspect {
  13. public static StringBuffer inits = new StringBuffer();
  14. pointcut outerMatch() : initialization(new(..)) && !within(InitAspect);
  15. before() : outerMatch() {
  16. inits.append(thisJoinPoint.getSignature().getDeclaringType().getName());
  17. inits.append(",");
  18. }
  19. }