From 9a65e1e9ff34300c1388eb81ed4246605e1c8b05 Mon Sep 17 00:00:00 2001 From: aclement Date: Thu, 5 Mar 2009 22:52:05 +0000 Subject: [PATCH] declareMixin --- .../mixin/base/src/CaseA.java | 27 +++++++++++++++++++ .../mixin/inc1/src/CaseA.java | 27 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 tests/multiIncremental/mixin/base/src/CaseA.java create mode 100644 tests/multiIncremental/mixin/inc1/src/CaseA.java 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"); + } +} -- 2.39.5