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.

CaseA.java 584B

123456789101112131415161718192021222324252627
  1. // TESTING: Very basics with a simple static factory method
  2. import org.aspectj.lang.annotation.*;
  3. public class CaseA {
  4. public static void main(String[]argv) {
  5. CaseA ca = new CaseA();
  6. ((I)ca).methodOne(); // will only succeed if mixin applied
  7. }
  8. }
  9. aspect X {
  10. @DeclareMixin("CaseA")
  11. public static I createImplementation() {
  12. System.out.println("Delegate factory invoked");
  13. return new Implementation();
  14. }
  15. }
  16. interface I {
  17. void methodOne();
  18. }
  19. class Implementation implements I {
  20. public void methodOne() {
  21. System.out.println("methodOne running");
  22. }
  23. }