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() {
<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