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.

TjpMistake.java 745B

1234567891011121314151617181920212223242526272829
  1. /** @testcase PR#75129 NPE on thisJoinPoint mistake */
  2. public class TjpMistake {
  3. public static void main(String[] a) {
  4. new C().go();
  5. new D().go();
  6. new E().go();
  7. }
  8. }
  9. interface I { void go();}
  10. class C {}
  11. class D {
  12. public void go() { System.out.println("D.go() in " + this); }
  13. }
  14. class E extends D {
  15. }
  16. aspect A {
  17. declare parents: (C || D) implements I;
  18. public void I.go() { System.out.println("I.go() in " + this); }
  19. before() : execution(* I.*(..)) {
  20. System.out.println(
  21. // mistake caused compiler crash rather than error
  22. thisJoinPoint.getSignature.toLongString() // CE 22
  23. // correct
  24. //thisJoinPointStaticPart.getSignature().toLongString()
  25. + " "
  26. + thisJoinPoint.getSignature().getDeclaringType()
  27. + " "
  28. + this); }
  29. }