From 749a909144a87ac8c45fffa1b5dc613bd30100e4 Mon Sep 17 00:00:00 2001 From: aclement Date: Mon, 22 Aug 2005 18:32:20 +0000 Subject: genericitds: activating more tests - including "uberaspects - U" - please dont look at it... --- tests/java5/generics/genericaspects/GenericAspectO.aj | 2 +- tests/java5/generics/genericaspects/GenericAspectT.aj | 2 +- tests/java5/generics/genericaspects/GenericAspectU.aj | 14 +++++++++----- 3 files changed, 11 insertions(+), 7 deletions(-) (limited to 'tests/java5/generics') 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 { public static void main(String []argv) { - // Field fiddling + Top t = new Top(); Bottom.parent = t; // error - its not a static field List kids = new ArrayList(); 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

{} + interface 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 { interface ParentHasChildren{} @@ -11,7 +13,7 @@ abstract aspect ParentChildRelationship { declare parents: Parent implements ParentHasChildren; declare parents: Child implements ChildHasParent; - public List ParentHasChildren.children; + public List ParentHasChildren.children = new ArrayList(); public P ChildHasParent

.parent; public List ParentHasChildren.getChildren() { @@ -23,6 +25,7 @@ abstract aspect ParentChildRelationship { } public void ChildHasParent.setParent(R parent) { + this.parent = parent; ((ParentHasChildren)parent).addChild(this); } @@ -99,12 +102,13 @@ aspect GenericAspectU extends ParentChildRelationship { "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); -- cgit v1.2.3