aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authoraclement <aclement>2009-03-06 18:57:46 +0000
committeraclement <aclement>2009-03-06 18:57:46 +0000
commit82692416fb2dbae3d95a05c495e4917cb09ea0db (patch)
tree75f4a6b4afd8125694faab303b3b276ce83b9dce /tests
parentd4db815bd941b1a07c8c961613672480afbce8e4 (diff)
downloadaspectj-82692416fb2dbae3d95a05c495e4917cb09ea0db.tar.gz
aspectj-82692416fb2dbae3d95a05c495e4917cb09ea0db.zip
declaremixin
Diffstat (limited to 'tests')
-rw-r--r--tests/src/org/aspectj/systemtest/ajc164/DeclareMixinTests.java30
-rw-r--r--tests/src/org/aspectj/systemtest/ajc164/declareMixin.xml47
2 files changed, 76 insertions, 1 deletions
diff --git a/tests/src/org/aspectj/systemtest/ajc164/DeclareMixinTests.java b/tests/src/org/aspectj/systemtest/ajc164/DeclareMixinTests.java
index 1997c361c..5651913d6 100644
--- a/tests/src/org/aspectj/systemtest/ajc164/DeclareMixinTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc164/DeclareMixinTests.java
@@ -99,6 +99,36 @@ public class DeclareMixinTests extends org.aspectj.testing.XMLBasedAjcTestCase {
runTest("casek");
}
+ // mixin of a class - should be an error (this one reported by the compiler due to a failed cast)
+ public void testCaseL() {
+ runTest("casel");
+ }
+
+ // mixin of a class - should be an error (this one reported by the annotation processing)
+ public void testCaseM() {
+ runTest("casem");
+ }
+
+ // factory returns class but interface specified - this is OK
+ public void testCaseN() {
+ runTest("casen");
+ }
+
+ // factory returns class but interface specified - not ok as class doesn't implement interface
+ public void testCaseO() {
+ runTest("caseo");
+ }
+
+ // interface subsetting used (factory returns class) - but only one method should be delegated
+ public void testCaseP() {
+ runTest("casep");
+ }
+
+ // factory return type implements two interfaces, both should be mixed as specified
+ public void testCaseQ() {
+ runTest("caseq");
+ }
+
// --
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 6bf37adfa..cb229374c 100644
--- a/tests/src/org/aspectj/systemtest/ajc164/declareMixin.xml
+++ b/tests/src/org/aspectj/systemtest/ajc164/declareMixin.xml
@@ -102,5 +102,50 @@
<message kind="error" text="factory methods for a mixin can take a maximum of one parameter"/>
</compile>
</ajc-test>
-
+
+ <ajc-test dir="features164/declareMixin" title="casel">
+ <compile files="CaseL.java" options="-1.5">
+ <message kind="error" text="Cannot cast from CaseL to C"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="features164/declareMixin" title="casem">
+ <compile files="CaseM.java" options="-1.5">
+ <message kind="error" text=": factory methods for a mixin must either return an interface type or specify interfaces in the annotation and return a class"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="features164/declareMixin" title="casen">
+ <compile files="CaseN.java" options="-1.5"/>
+ <run class="CaseN">
+ <stdout>
+ <line text="foo() running"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="features164/declareMixin" title="caseo">
+ <compile files="CaseO.java" options="-1.5">
+ <message kind="error" text="factory method does not return something that implements 'I'"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="features164/declareMixin" title="casep">
+ <compile files="CaseP.java" options="-1.5"/>
+ <run class="CaseP">
+ <stdout>
+ <line text="foo() running"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="features164/declareMixin" title="caseq">
+ <compile files="CaseQ.java" options="-1.5"/>
+ <run class="CaseQ">
+ <stdout>
+ <line text="foo() running"/>
+ <line text="goo() running"/>
+ </stdout>
+ </run>
+ </ajc-test>
</suite> \ No newline at end of file