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.

CaseP.java 722B

1234567891011121314151617181920212223242526272829303132333435
  1. // TESTING: interface subsetting used (factory returns class) - but only one method should be delegated
  2. import org.aspectj.lang.annotation.*;
  3. public class CaseP {
  4. public static void main(String[]argv) {
  5. ((I)new CaseP()).foo();
  6. CaseP cp = new CaseP();
  7. if (cp instanceof J) { // should not have been mixed in
  8. throw new RuntimeException();
  9. }
  10. }
  11. }
  12. aspect X {
  13. @DeclareMixin(value="CaseP",interfaces={I.class})
  14. public static C createImplementation1() {return new C();}
  15. }
  16. interface I {
  17. void foo();
  18. }
  19. interface J {
  20. void goo();
  21. }
  22. class C implements I,J {
  23. public void foo() {
  24. System.out.println("foo() running");
  25. }
  26. public void goo() {
  27. System.out.println("goo() running");
  28. }
  29. }