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.

IntroducingMethodsOnPlusImplementedInterfaces.java 610B

12345678910111213141516171819202122
  1. import org.aspectj.testing.Tester;
  2. public class IntroducingMethodsOnPlusImplementedInterfaces {
  3. public static void main(String[] args) {
  4. new IntroducingMethodsOnPlusImplementedInterfaces().realMain(args);
  5. }
  6. public void realMain(String[] args) {
  7. new D().f();
  8. }
  9. static {
  10. Tester.expectEvent("D.f");
  11. }
  12. }
  13. class D extends Thread {}
  14. //static
  15. aspect A {
  16. static interface I {}
  17. //(subtypes(Thread)) +implements I;
  18. //declare parents: (subtypes(Thread)) implements I;
  19. declare parents: Thread+ implements I;
  20. public void I.f() { Tester.event("D.f"); }
  21. }