aboutsummaryrefslogtreecommitdiffstats
path: root/tests/features164/declareMixin/CaseC.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/features164/declareMixin/CaseC.java')
-rw-r--r--tests/features164/declareMixin/CaseC.java31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/features164/declareMixin/CaseC.java b/tests/features164/declareMixin/CaseC.java
new file mode 100644
index 000000000..ee11f3959
--- /dev/null
+++ b/tests/features164/declareMixin/CaseC.java
@@ -0,0 +1,31 @@
+// TESTING: factory method takes the object for which the delegate exists
+import org.aspectj.lang.annotation.*;
+
+public class CaseC {
+ public static void main(String[]argv) {
+ CaseC cc = new CaseC();
+ ((I)cc).methodOne(); // will only succeed if mixin applied
+ }
+
+ public String toString() {
+ return "CaseC instance";
+ }
+}
+
+aspect X {
+ @DeclareMixin("CaseC")
+ public static I createImplementation(Object o) {
+ System.out.println("Delegate factory invoked for "+o.toString());
+ return new Implementation();
+ }
+}
+
+interface I {
+ void methodOne();
+}
+
+class Implementation implements I {
+ public void methodOne() {
+ System.out.println("methodOne running");
+ }
+}