aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authoraclement <aclement>2009-03-05 22:52:05 +0000
committeraclement <aclement>2009-03-05 22:52:05 +0000
commit9a65e1e9ff34300c1388eb81ed4246605e1c8b05 (patch)
tree16a2954ef19d77db5fc1dd5bb3f68ac7ab89afc1 /tests
parentc4439a7a47124e646b0ef4b355eebb716b18c00e (diff)
downloadaspectj-9a65e1e9ff34300c1388eb81ed4246605e1c8b05.tar.gz
aspectj-9a65e1e9ff34300c1388eb81ed4246605e1c8b05.zip
declareMixin
Diffstat (limited to 'tests')
-rw-r--r--tests/multiIncremental/mixin/base/src/CaseA.java27
-rw-r--r--tests/multiIncremental/mixin/inc1/src/CaseA.java27
2 files changed, 54 insertions, 0 deletions
diff --git a/tests/multiIncremental/mixin/base/src/CaseA.java b/tests/multiIncremental/mixin/base/src/CaseA.java
new file mode 100644
index 000000000..b82c67618
--- /dev/null
+++ b/tests/multiIncremental/mixin/base/src/CaseA.java
@@ -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
index 000000000..163ad2c80
--- /dev/null
+++ b/tests/multiIncremental/mixin/inc1/src/CaseA.java
@@ -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");
+ }
+}