From: aclement Date: Wed, 4 Mar 2009 03:00:29 +0000 (+0000) Subject: declaremixin: check signature of factory method X-Git-Tag: pre268419~33 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a717f689d51d8392d1f81e50556e25f26658294f;p=aspectj.git declaremixin: check signature of factory method --- diff --git a/tests/features164/declareMixin/CaseJ.java b/tests/features164/declareMixin/CaseJ.java new file mode 100644 index 000000000..8b33faf6c --- /dev/null +++ b/tests/features164/declareMixin/CaseJ.java @@ -0,0 +1,17 @@ +// TESTING: invalid return type for factory method +import org.aspectj.lang.annotation.*; + +public class CaseJ { + public static void main(String[]argv) { } +} + +aspect X { + @DeclareMixin("A") + public static void createImplementation1() {} + + @DeclareMixin("A") + public static int createImplementation2(Object o) {return 2;} +} + +interface I {} + diff --git a/tests/features164/declareMixin/CaseK.java b/tests/features164/declareMixin/CaseK.java new file mode 100644 index 000000000..c41d7363b --- /dev/null +++ b/tests/features164/declareMixin/CaseK.java @@ -0,0 +1,15 @@ +// TESTING: too many arguments to the factory method +import org.aspectj.lang.annotation.*; + +public class CaseK { + public static void main(String[]argv) { } +} + +aspect X { + @DeclareMixin("A") + public static I createImplementation1(String s,long foo) {return null;} + +} + +interface I {} + diff --git a/tests/src/org/aspectj/systemtest/ajc164/DeclareMixinTests.java b/tests/src/org/aspectj/systemtest/ajc164/DeclareMixinTests.java index e18994cb0..1997c361c 100644 --- a/tests/src/org/aspectj/systemtest/ajc164/DeclareMixinTests.java +++ b/tests/src/org/aspectj/systemtest/ajc164/DeclareMixinTests.java @@ -21,7 +21,13 @@ import org.aspectj.testing.XMLBasedAjcTestCase; * In many ways the design is similar to DeclareParents now - so we have to plug in at the same points, but the code generation for * generating the delegate object and the choice of which interfaces (and methods within those) to mixin is different. * - *

Design and test considerations:


+ *

Tested:


+ * + * + *

Still to test/explore:


* * * @author Andy Clement @@ -84,6 +89,16 @@ public class DeclareMixinTests extends org.aspectj.testing.XMLBasedAjcTestCase { runTest("casei"); } + // invalid return type for factory method + public void testCaseJ() { + runTest("casej"); + } + + // too many arguments to the factory method + public void testCaseK() { + runTest("casek"); + } + // -- public static Test suite() { diff --git a/tests/src/org/aspectj/systemtest/ajc164/declareMixin.xml b/tests/src/org/aspectj/systemtest/ajc164/declareMixin.xml index a9ed438ba..6bf37adfa 100644 --- a/tests/src/org/aspectj/systemtest/ajc164/declareMixin.xml +++ b/tests/src/org/aspectj/systemtest/ajc164/declareMixin.xml @@ -89,5 +89,18 @@ + + + + + + + + + + + + + \ No newline at end of file