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/java5/generics | |
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/java5/generics')
-rw-r--r-- | tests/java5/generics/genericaspects/GenericAspectO.aj | 2 | ||||
-rw-r--r-- | tests/java5/generics/genericaspects/GenericAspectT.aj | 2 | ||||
-rw-r--r-- | tests/java5/generics/genericaspects/GenericAspectU.aj | 14 |
3 files changed, 11 insertions, 7 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); |