From: aclement Date: Thu, 5 Mar 2009 22:52:05 +0000 (+0000) Subject: declareMixin X-Git-Tag: pre268419~29 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9a65e1e9ff34300c1388eb81ed4246605e1c8b05;p=aspectj.git declareMixin --- 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"); + } +}