]> source.dussan.org Git - aspectj.git/commitdiff
declaremixin
authoraclement <aclement>
Fri, 6 Mar 2009 18:57:46 +0000 (18:57 +0000)
committeraclement <aclement>
Fri, 6 Mar 2009 18:57:46 +0000 (18:57 +0000)
tests/src/org/aspectj/systemtest/ajc164/DeclareMixinTests.java
tests/src/org/aspectj/systemtest/ajc164/declareMixin.xml

index 1997c361c486bc8c1d0b1c59e52c31d626a15660..5651913d6bfcaa2eb9deb582e73c1a47e94b3e96 100644 (file)
@@ -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() {
index 6bf37adfad6b5a3fe7fcf183f3834fe3c763e229..cb229374c7d78d171781ddb5485d6632633635a9 100644 (file)
          <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