]> source.dussan.org Git - aspectj.git/commitdiff
declareMixin
authoraclement <aclement>
Thu, 5 Mar 2009 22:52:05 +0000 (22:52 +0000)
committeraclement <aclement>
Thu, 5 Mar 2009 22:52:05 +0000 (22:52 +0000)
tests/multiIncremental/mixin/base/src/CaseA.java [new file with mode: 0644]
tests/multiIncremental/mixin/inc1/src/CaseA.java [new file with mode: 0644]

diff --git a/tests/multiIncremental/mixin/base/src/CaseA.java b/tests/multiIncremental/mixin/base/src/CaseA.java
new file mode 100644 (file)
index 0000000..b82c676
--- /dev/null
@@ -0,0 +1,27 @@
+// TESTING: Very basics with a simple static factory method
+import org.aspectj.lang.annotation.*;
+
+public class CaseA {
+  public static void main(String[]argv) {
+    CaseA ca = new CaseA();
+    ((I)ca).methodOne(); // will only succeed if mixin applied
+  }
+}
+
+aspect X {
+  @DeclareMixin("CaseA")
+  public static I createImplementation() {
+    System.out.println("Delegate factory invoked");
+    return new Implementation();
+  }
+}
+
+interface I {
+  void methodOne();
+}
+
+class Implementation implements I {
+  public void methodOne() {
+    System.out.println("methodOne running");
+  }
+}
diff --git a/tests/multiIncremental/mixin/inc1/src/CaseA.java b/tests/multiIncremental/mixin/inc1/src/CaseA.java
new file mode 100644 (file)
index 0000000..163ad2c
--- /dev/null
@@ -0,0 +1,27 @@
+// TESTING: Very basics with a simple static factory method
+import org.aspectj.lang.annotation.*;
+public class CaseA {
+  public static void main(String[]argv) {
+    CaseA ca = new CaseA();
+    ((I)ca).methodOne(); // will only succeed if mixin applied
+  }
+}
+
+aspect X {
+  @DeclareMixin("CaseA")
+  public static I createImplementation() {
+    System.out.println("Delegate factory invoked");
+    return new Implementation();
+  }
+}
+
+interface I {
+  void methodOne();
+}
+
+class Implementation implements I {
+  public void methodOne() {
+    System.out.println("methodOne running");
+  }
+}