diff options
author | aclement <aclement> | 2005-08-22 18:32:20 +0000 |
---|---|---|
committer | aclement <aclement> | 2005-08-22 18:32:20 +0000 |
commit | 749a909144a87ac8c45fffa1b5dc613bd30100e4 (patch) | |
tree | dc9c9748cde7689a87d27ab228f1d40038328288 /tests | |
parent | 5d7a5587c7316b97337608985bf5edb85b1ab5f5 (diff) | |
download | aspectj-749a909144a87ac8c45fffa1b5dc613bd30100e4.tar.gz aspectj-749a909144a87ac8c45fffa1b5dc613bd30100e4.zip |
genericitds: activating more tests - including "uberaspects - U" - please dont look at it...
Diffstat (limited to 'tests')
5 files changed, 31 insertions, 21 deletions
diff --git a/tests/java5/generics/genericaspects/GenericAspectO.aj b/tests/java5/generics/genericaspects/GenericAspectO.aj index ee910f7ac..297d2a656 100644 --- a/tests/java5/generics/genericaspects/GenericAspectO.aj +++ b/tests/java5/generics/genericaspects/GenericAspectO.aj @@ -20,7 +20,7 @@ aspect GenericAspectO extends ParentChildRelationship<Top,Bottom> { public static void main(String []argv) { - // Field fiddling + Top t = new Top(); Bottom.parent = t; // error - its not a static field List<Bottom> kids = new ArrayList<Bottom>(); kids.add(t); diff --git a/tests/java5/generics/genericaspects/GenericAspectT.aj b/tests/java5/generics/genericaspects/GenericAspectT.aj index 8efc804b7..c2e4f425f 100644 --- a/tests/java5/generics/genericaspects/GenericAspectT.aj +++ b/tests/java5/generics/genericaspects/GenericAspectT.aj @@ -4,7 +4,7 @@ import org.aspectj.lang.annotation.*; aspect ParentChildRelationship { - interface I<P extends I>{} + interface I<P extends I>{} // scary! public String I.parent; diff --git a/tests/java5/generics/genericaspects/GenericAspectU.aj b/tests/java5/generics/genericaspects/GenericAspectU.aj index 7197a51f0..860a153ca 100644 --- a/tests/java5/generics/genericaspects/GenericAspectU.aj +++ b/tests/java5/generics/genericaspects/GenericAspectU.aj @@ -3,6 +3,8 @@ import java.lang.reflect.*; import org.aspectj.lang.annotation.*; +// JUST DONT ASK HOW THIS WORKS + abstract aspect ParentChildRelationship<Parent,Child> { interface ParentHasChildren<C>{} @@ -11,7 +13,7 @@ abstract aspect ParentChildRelationship<Parent,Child> { declare parents: Parent implements ParentHasChildren<Child>; declare parents: Child implements ChildHasParent<Parent>; - public List<E> ParentHasChildren<E>.children; + public List<E> ParentHasChildren<E>.children = new ArrayList<E>(); public P ChildHasParent<P>.parent; public List<D> ParentHasChildren<D>.getChildren() { @@ -23,6 +25,7 @@ abstract aspect ParentChildRelationship<Parent,Child> { } public void ChildHasParent<R>.setParent(R parent) { + this.parent = parent; ((ParentHasChildren)parent).addChild(this); } @@ -99,12 +102,13 @@ aspect GenericAspectU extends ParentChildRelationship<Top,Bottom> { "parent check 2 failed "+ "retrieved="+retrievedParent2+" expected="+top2); + Top top3 = new Top(); Bottom bot2 = new Bottom(); - top2.addChild(bot2); - Bottom aBottom = top2.getChildren().get(0); + top3.addChild(bot2); + Bottom aBottom = top3.getChildren().get(0); check(aBottom==bot2,"Incorrect child? expected="+bot2+" found="+aBottom); - top2.removeChild(bot2); - int size=top2.getChildren().size(); + top3.removeChild(bot2); + int size=top3.getChildren().size(); check(size==0,"Should be no children but there were "+size); diff --git a/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java b/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java index 5adfad3f6..0a12d2df8 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java +++ b/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java @@ -353,18 +353,19 @@ public class GenericsTests extends XMLBasedAjcTestCase { public void testSophisticatedAspectsH() {runTest("uberaspects - H");} public void testSophisticatedAspectsI() {runTest("uberaspects - I");} public void testSophisticatedAspectsJ() {runTest("uberaspects - J");} -// public void testSophisticatedAspectsK() {runTest("uberaspects - K");} // FIXME asc needs some error messages writing + // next test commented out, error message is less than ideal - see + // comment in test program as to what should be expected + //public void testSophisticatedAspectsK() {runTest("uberaspects - K");} public void testSophisticatedAspectsL() {runTest("uberaspects - L");} -// public void testSophisticatedAspectsM() {runTest("uberaspects - M");} // FIXME asc needs some error messages writing + public void testSophisticatedAspectsM() {runTest("uberaspects - M");} public void testSophisticatedAspectsN() {runTest("uberaspects - N");} -// public void testSophisticatedAspectsO() {runTest("uberaspects - O");} // FIXME asc needs some error messages writing + public void testSophisticatedAspectsO() {runTest("uberaspects - O");} public void testSophisticatedAspectsP() {runTest("uberaspects - P");} public void testSophisticatedAspectsQ() {runTest("uberaspects - Q");} public void testSophisticatedAspectsR() {runTest("uberaspects - R");} public void testSophisticatedAspectsS() {runTest("uberaspects - S");} public void testSophisticatedAspectsT() {runTest("uberaspects - T");} - - //public void testSophisticatedAspectsU() {runTest("uberaspects - U");} + public void testSophisticatedAspectsU() {runTest("uberaspects - U");} // includes nasty casts public void testBinaryWeavingITDsA() {runTest("binary weaving ITDs - A");} diff --git a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml index 4f069aa52..cc446c82f 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml +++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml @@ -3087,27 +3087,32 @@ <run class="GenericAspectJ"/> </ajc-test> <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - K"> - <compile files="GenericAspectK.aj" options="-1.5"/> - <!-- will need error messages in here --> - <run class="GenericAspectK"/> + <compile files="GenericAspectK.aj" options="-1.5"> + <message kind="error" line="16" text="The method m4(String) is undefined for the type Base"/> + </compile> </ajc-test> <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - L"> <compile files="GenericAspectL.aj" options="-1.5"/> <run class="GenericAspectL"/> </ajc-test> <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - M"> - <compile files="GenericAspectM.aj" options="-1.5"/> - <!-- will need error messages in here --> - <run class="GenericAspectM"/> + <compile files="GenericAspectM.aj" options="-1.5"> + <message kind="error" line="23" text="The method m0(Integer) in the type GenericAspect<A,B>.SimpleI<L> is not applicable for the arguments (String)"/> + <message kind="error" line="24" text="The method m1(List<Integer>) in the type GenericAspect<A,B>.SimpleI<L> is not applicable for the arguments (List<String>)"/> + <message kind="error" line="25" text="Type mismatch: cannot convert from String to Integer"/> + <message kind="error" line="26" text="Type mismatch: cannot convert from List<String> to List<Integer>"/> + </compile> </ajc-test> <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - N"> <compile files="GenericAspectN.aj" options="-1.5"/> <run class="GenericAspectN"/> </ajc-test> <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - O"> - <compile files="GenericAspectO.aj" options="-1.5"/> - <!-- will need error messages in here --> - <run class="GenericAspectO"/> + <compile files="GenericAspectO.aj" options="-1.5"> + <message kind="error" line="24" text="Cannot make a static reference to the non-static field Bottom.parent"/> + <message kind="error" line="26" text="The method add(Bottom) in the type List<E> is not applicable for the arguments (Top)"/> + <message kind="error" line="27" text="Cannot make a static reference to the non-static field Top.children"/> + </compile> </ajc-test> <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - P"> <compile files="GenericAspectP.aj" options="-1.5"/> |