]> source.dussan.org Git - aspectj.git/commitdiff
genericitds: tests moved around and activated in GenericsTests
authoraclement <aclement>
Mon, 22 Aug 2005 17:00:01 +0000 (17:00 +0000)
committeraclement <aclement>
Mon, 22 Aug 2005 17:00:01 +0000 (17:00 +0000)
22 files changed:
tests/java5/generics/binaryweaving/A1.aj [new file with mode: 0644]
tests/java5/generics/binaryweaving/C1.aj [new file with mode: 0644]
tests/java5/generics/genericaspects/GenericAspectT.aj
tests/java5/generics/genericaspects/GenericAspectU.aj
tests/java5/generics/genericaspects/ParentChildRelationship.aj
tests/java5/generics/itds/Parse5.java
tests/java5/generics/itds/binaryweaving/A1.aj
tests/java5/generics/itds/binaryweaving/A2.aj
tests/java5/generics/itds/binaryweaving/A3.aj
tests/java5/generics/itds/binaryweaving/BaseClass.java
tests/java5/generics/itds/binaryweaving/TestA_aspect.aj [new file with mode: 0644]
tests/java5/generics/itds/binaryweaving/TestA_class.java [new file with mode: 0644]
tests/java5/generics/itds/binaryweaving/TestA_generictype.java [new file with mode: 0644]
tests/java5/generics/itds/sharing/GenericAspectA.aj [deleted file]
tests/java5/generics/itds/sharing/GenericAspectB.aj [deleted file]
tests/java5/generics/itds/sharing/GenericAspectC.aj [deleted file]
tests/java5/generics/itds/sharing/GenericAspectD.aj [deleted file]
tests/java5/generics/itds/sharing/GenericAspectE.aj [deleted file]
tests/java5/generics/itds/sharing/MethodA4.aj
tests/java5/generics/itds/sharing/MethodQ.aj
tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java
tests/src/org/aspectj/systemtest/ajc150/ajc150.xml

diff --git a/tests/java5/generics/binaryweaving/A1.aj b/tests/java5/generics/binaryweaving/A1.aj
new file mode 100644 (file)
index 0000000..45f7fe7
--- /dev/null
@@ -0,0 +1,5 @@
+aspect A1 {
+  declare parents: C* implements I<String>;
+}
+
+interface I<T> {}
diff --git a/tests/java5/generics/binaryweaving/C1.aj b/tests/java5/generics/binaryweaving/C1.aj
new file mode 100644 (file)
index 0000000..b76d06a
--- /dev/null
@@ -0,0 +1 @@
+class C1 {}
index a34e4c0b4ada892efc5bd5a8798e98f004cccbe1..8efc804b76ae4d90efc9aecd29cba2fd65a48db9 100644 (file)
@@ -4,11 +4,11 @@ import org.aspectj.lang.annotation.*;
 
 aspect ParentChildRelationship {
 
-  interface I<P>{}
+  interface I<P extends I>{}
 
   public String I.parent;
 
-  public void I<T>.do(T a) {
+  public void I<T>.abc(T a) {
     a.parent=null;
   }
 
index 8ed1f100eb8d8639823e24c5e5751650084ad35c..7197a51f0df7ff3463df924876a03829a787d451 100644 (file)
@@ -2,6 +2,7 @@ import java.util.*;
 import java.lang.reflect.*;
 import org.aspectj.lang.annotation.*;
 
+
 abstract aspect ParentChildRelationship<Parent,Child> {
 
   interface ParentHasChildren<C>{}
@@ -22,27 +23,25 @@ abstract aspect ParentChildRelationship<Parent,Child> {
   }
 
   public void ChildHasParent<R>.setParent(R parent) {
-//    parent.addChild(this);
+    ((ParentHasChildren)parent).addChild(this);
   }
 
   public void ParentHasChildren<X>.addChild(X child) {
-    //if (child.parent != null) {
-      //child.parent.removeChild(child);
-   // }
+    if (((ChildHasParent)child).parent != null) {
+      ((ParentHasChildren)((ChildHasParent)child).parent).removeChild(child);
+    }
     children.add(child);
   }
 
-/*
   public void ParentHasChildren<Y>.removeChild(Y child) {
     if (children.remove(child)) {
-      child.parent = null;
+      ((ChildHasParent)child).parent = null;
     }
   }
-*/
 
 }
 
-aspect GenericAspectT extends ParentChildRelationship<Top,Bottom> { 
+aspect GenericAspectU extends ParentChildRelationship<Top,Bottom> { 
 
   public static void main(String []argv) {
 
@@ -92,7 +91,7 @@ aspect GenericAspectT extends ParentChildRelationship<Top,Bottom> {
       "parent check 1 failed "+
       "retrieved="+retrievedParent+"  expected="+t);
 
-/*
+
     Top top2 = new Top();
     b.setParent(top2);
     Top retrievedParent2 = b.getParent();
@@ -102,12 +101,12 @@ aspect GenericAspectT extends ParentChildRelationship<Top,Bottom> {
     
     Bottom bot2 = new Bottom();
     top2.addChild(bot2);
-    //Bottom aBottom = top2.getChildren().get(0);
-    //check(aBottom==bot2,"Incorrect child? expected="+bot2+" found="+aBottom);
-    //top2.removeChild(bot2);
-    //int size=top2.getChildren().size();
-    //check(size==0,"Should be no children but there were "+size);
-*/
+    Bottom aBottom = top2.getChildren().get(0);
+    check(aBottom==bot2,"Incorrect child? expected="+bot2+" found="+aBottom);
+    top2.removeChild(bot2);
+    int size=top2.getChildren().size();
+    check(size==0,"Should be no children but there were "+size);
+
 
   }
 
index 3e34e3afda344f62ce3ecfa3ee880047467a6d01..6d9624d6d0be26c0f7ae97c9642052ca6aa4f090 100644 (file)
@@ -1,61 +1,86 @@
 import java.util.*;
+import org.aspectj.lang.annotation.*;
+abstract aspect ParentChildRelationship<Parent,Child> {
 
-public abstract aspect ParentChildRelationship<P,C> {
-    
-    /**
-     * Parents contain a list of children
-     */
-    private List<C> P.children;
-        
-    /**
-     * Each child has a parent
-     */
-    private P C.parent;
+  /** interface implemented by parents */   
+  interface ParentHasChildren<C>{
+//    List<C> getChildren();
+//    void addChild(C child);
+//    void removeChild(C child);
+  }
+
+  /** interface implemented by children */
+  interface ChildHasParent<P>{
+//    P getParent();
+//    void setParent(P parent);
+  }
+
+  /** ensure the parent type implements ParentHasChildren<child type> */
+  declare parents: Parent implements ParentHasChildren<Child>;
+
+  /** ensure the child type implements ChildHasParent<parent type> */
+  declare parents: Child  implements ChildHasParent<Parent>;
+
+  // Inter-type declarations made on the *generic* interface types to provide 
+  // default implementations.
+
+  /** list of children maintained by parent */
+  public List<E> ParentHasChildren<E>.children = new ArrayList<E>();
+
+  /** reference to parent maintained by child */        
+  public P ChildHasParent<P>.parent;
+
+  /** Default implementation of getChildren for the generic type ParentHasChildren */
+  public List<D> ParentHasChildren<D>.getChildren() {
+    return Collections.unmodifiableList(children);  
+  }
+
+  /** Default implementation of getParent for the generic type ChildHasParent */    
+  public P ChildHasParent<P>.getParent() {
+    return parent;
+  }
 
     /**
-      * Parents provide access to their children
+      * Default implementation of setParent for the generic type ChildHasParent.
+      * Ensures that this child is added to the children of the parent too.
       */
-    public List<C> P.getChildren() {
-        return Collections.unmodifiableList(children);  
-    }
-    
-    /**
-     * A child provides access to its parent
-     */
-     public P C.getParent() {
-       return parent;
-     }
-    
-    /**
-     * ensure bi-directional navigation on adding a child
-     */
-    public void P.addChild(C child) {
-       if (child.parent != null) {
-         child.parent.removeChild(child);
-       }
-       children.add(child);
-       child.parent = this;
-    }
+  public void ChildHasParent<R>.setParent(R parent) {
+    ((ParentHasChildren)parent).addChild(this);
+  }
 
-    /**
-     * ensure bi-directional navigation on removing a child
-     */
-    public void P.removeChild(C child) {
-       if (children.remove(child)) {
-         child.parent = null;
-       }
+  /** 
+    * Default implementation of addChild, ensures that parent of child is
+    * also updated.
+    */ 
+  public void ParentHasChildren<X>.addChild(X child) {
+    if (((ChildHasParent)child).parent != null) {
+      ((ParentHasChildren)((ChildHasParent)child).parent).removeChild(child);
     }
+    children.add(child);
+    ((ChildHasParent)child).parent = (ParentHasChildren)this;
+  }
 
    /**
-     * ensure bi-directional navigation on setting parent
+     * Default implementation of removeChild, ensures that parent of
+     * child is also updated.
      */
-    public void C.setParent(P parent) {
-       parent.addChild(this);
+  public void ParentHasChildren<Y>.removeChild(Y child) {
+    if (children.remove(child)) {
+      ((ChildHasParent)child).parent = null;
     }
-    
-    public pointcut addingChild(P p, C c) :
-      execution(* P.addChild(C)) && this(p) && args(c);
+  }
+    /**
+      * Matches at an addChild join point for the parent type P and child type C
+      */    
+    @SuppressAjWarnings
+    public pointcut addingChild(Parent p, Child c) :
+      execution(* Parent.addChild(Child)) && this(p) && args(c);
       
-    public pointcut removingChild(P p, C c) :
-      execution(* P.removeChild(C)) && this(p) && args(c);
+    /**
+      * Matches at a removeChild join point for the parent type P and child type C
+      */    
+    @SuppressAjWarnings
+    public pointcut removingChild(Parent p, Child c) :
+      execution(* Parent.removeChild(Child)) && this(p) && args(c);
+
 }
index c322f006db4b6cd935e10bf52bd722242aa17052..30514a5d95c30e0b45a05a306c7e6781067a052a 100644 (file)
@@ -2,15 +2,15 @@
 public class Parse5<T,S extends Number> {}
 
 aspect X {
-  String Parse5.m1() {}
+  void Parse5.m1() {}
 
-  String Parse5<Q,R extends Number>.m2() {}
+  void Parse5<Q,R>.m2() {}
 
-  String Parse5<T,V>.m3() {} // error
+  void Parse5<T,V>.m3() {}
  
-  String Parse5<A,B extends Number,C>.m4() {} // error
+  void Parse5<A,B,C>.m4() {} // error
 
-  String Parse5<A>.m5() {} // error
+  void Parse5<A>.m5() {} // error
   
-  String Parse5<String,Integer>.m6() {} // error
+  void Parse5<String,Integer>.m6() {} // error
 }
index 005d9dc2de5fbf634b47192f72060856940f5abd..c1a25632a48606c2ea88a020f4a00d741c317c69 100644 (file)
@@ -7,7 +7,7 @@ aspect A1 {
   after(BaseClass c): execution(* run1(..)) && this(c) {
     List<String> myLs = new ArrayList<String>();
     c.list1 = myLs;
-    System.err.println("Advice from A1 ran successfully");
+    c.count++;
   }
 
 }
index 20fb8baf58590c0a717bdff69677ef4ca9ec61ca..1837d3e0a39e8572260ef518d9db7d5a4502f0aa 100644 (file)
@@ -1,13 +1,14 @@
 import java.util.*;
 
 aspect A2 {
+//  declare precedence: A2,A1;
 
   public List<Z> BaseClass<Z>.list2;
 
   after(): execution(* run2(..)) {
     BaseClass<Integer> bInt = new BaseClass<Integer>();
     bInt.list2 = new ArrayList<Integer>();
-    System.err.println("Advice from A2 ran successfully");
+    bInt.count++;
   }
 
 }
index cacd30e0d99f308330c07c90e7cf7d838f13ce6c..66f80ba0a426eccfe0345f85782956d308065f9d 100644 (file)
@@ -2,6 +2,8 @@ import java.util.*;
 
 aspect A3 {
 
+//  declare precedence: A3,A2;
+
   public List<Z> BaseClass<Z>.m(List<Z> lz) {
     return lz;
   }
@@ -10,7 +12,7 @@ aspect A3 {
     List<String> myLs = new ArrayList<String>();
     BaseClass<String> bStr = new BaseClass<String>();
     List<String> ls2 = bStr.m(myLs);
-    System.err.println("Advice from A3 ran successfully");
+    bStr.count++;
   }
 
 }
index edd3e4c9398d0ddf809854c73e7541efaefcf675..225dddd468b184d52a53f548cd67c3e70870a597 100644 (file)
@@ -1,9 +1,12 @@
 public class BaseClass<N> {
+  static int count = 0;
+
   public static void main(String[]argv) {
     BaseClass b = new BaseClass();
     b.run1();
     b.run2();
     b.run3();
+    System.err.println("Advice count="+count);
   }
 
   public void run1() {}
diff --git a/tests/java5/generics/itds/binaryweaving/TestA_aspect.aj b/tests/java5/generics/itds/binaryweaving/TestA_aspect.aj
new file mode 100644 (file)
index 0000000..d2c4239
--- /dev/null
@@ -0,0 +1,6 @@
+import java.util.*;
+
+aspect TestA_aspect {
+  // scary, multiple tvars, one from member, one from target
+  public <L extends Number> void TestA_generictype<Z>.m(List<L> ll1, List<Z> lz,List<L> ll2) {} 
+}
diff --git a/tests/java5/generics/itds/binaryweaving/TestA_class.java b/tests/java5/generics/itds/binaryweaving/TestA_class.java
new file mode 100644 (file)
index 0000000..b5c6c01
--- /dev/null
@@ -0,0 +1,10 @@
+import java.util.*;
+
+public class TestA_class {
+  public static void main(String []argv) { 
+    TestA_generictype<Float> sc = new TestA_generictype<Float>();
+    List<Integer> li = new ArrayList<Integer>();
+    List<Float> lf = new ArrayList<Float>();
+    sc.m(li,lf,li);
+  }
+}
diff --git a/tests/java5/generics/itds/binaryweaving/TestA_generictype.java b/tests/java5/generics/itds/binaryweaving/TestA_generictype.java
new file mode 100644 (file)
index 0000000..005d936
--- /dev/null
@@ -0,0 +1,4 @@
+import java.util.*;
+
+class TestA_generictype<N> {// extends Number> { 
+}
diff --git a/tests/java5/generics/itds/sharing/GenericAspectA.aj b/tests/java5/generics/itds/sharing/GenericAspectA.aj
deleted file mode 100644 (file)
index fcb3090..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-// Simple - adding an interface to a type via a generic aspect and decp
-abstract aspect GenericAspect<A> {
-
-  declare parents: A implements SimpleI;
-
-  interface SimpleI {}
-
-}
-
-aspect GenericAspectA extends GenericAspect<Base> {
-  public static void main(String []argv) {
-    Base b = new Base();
-    if (!(b instanceof SimpleI)) 
-      throw new RuntimeException("Base should implement SimpleI!");
-  }
-}
-
-class Base {}
-
diff --git a/tests/java5/generics/itds/sharing/GenericAspectB.aj b/tests/java5/generics/itds/sharing/GenericAspectB.aj
deleted file mode 100644 (file)
index 39d2622..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-// Decp a generic interface
-abstract aspect GenericAspect<A> {
-
-  declare parents: A implements SimpleI;
-
-  interface SimpleI<X> {}
-
-}
-
-aspect GenericAspectB extends GenericAspect<Base> {
-  public static void main(String []argv) {
-    Base b = new Base();
-    if (!(b instanceof SimpleI)) 
-      throw new RuntimeException("Base should implement SimpleI!");
-  }
-}
-
-class Base {}
-
diff --git a/tests/java5/generics/itds/sharing/GenericAspectC.aj b/tests/java5/generics/itds/sharing/GenericAspectC.aj
deleted file mode 100644 (file)
index 3e1d6c6..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-// Decp an interface with an ITD method on it
-abstract aspect GenericAspect<A> {
-
-  interface SimpleI {}
-
-  declare parents: A implements SimpleI;
-
-  public int SimpleI.m() { return 4;}
-
-}
-
-aspect GenericAspectC extends GenericAspect<Base> {
-  public static void main(String []argv) {
-    Base b = new Base();
-
-    if (!(b instanceof SimpleI)) 
-      throw new RuntimeException("Base should implement SimpleI!");
-
-    int i = b.m();
-  }
-}
-
-class Base {}
-
diff --git a/tests/java5/generics/itds/sharing/GenericAspectD.aj b/tests/java5/generics/itds/sharing/GenericAspectD.aj
deleted file mode 100644 (file)
index 30775a5..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-// Decp an interface with an ITD field
-abstract aspect GenericAspect<A> {
-
-  interface SimpleI {}
-
-  declare parents: A implements SimpleI;
-
-  public int SimpleI.n;
-
-}
-
-aspect GenericAspectD extends GenericAspect<Base> {
-  public static void main(String []argv) {
-    Base b = new Base();
-
-    if (!(b instanceof SimpleI)) 
-      throw new RuntimeException("Base should implement SimpleI!");
-
-    b.n=42;
-  }
-}
-
-class Base {}
-
diff --git a/tests/java5/generics/itds/sharing/GenericAspectE.aj b/tests/java5/generics/itds/sharing/GenericAspectE.aj
deleted file mode 100644 (file)
index 60bf8cd..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-abstract aspect GenericAspect<A> {
-
-  declare parents: A implements IUtil;
-
-  //public void IUtil<Z>.print(Z n) { System.err.println(n); }
-}
-
-interface IUtil<N extends Number> { }
-
-aspect GenericAspectE extends GenericAspect<Base> {
-  public static void main(String []argv) {
-    Base b = new Base();
-    // b.print("hello");
-  }
-}
-
-class Base {}
-
index 64c2aced0de5ea2251327117532de03d61264adf..192a7dc98bf5e816ad7ce42516432738b4460f34 100644 (file)
@@ -12,6 +12,8 @@ class Base<N extends Number> { }
 aspect X {
   public List<Z> Base<Z>.m() { // OK, Z becomes N in return type
     List<Z> lz = new ArrayList<Z>();
+    List<String> ls;
+
     return lz;
   }; 
 }
index bfe415a28ddb0e89fb520cbe828d583e57c51761..979c3b39a7b37fa3da3bd738c76aa3ab4b23a9b8 100644 (file)
@@ -9,7 +9,7 @@ public class MethodQ {
   }
 }
 
-class SimpleClass<N extends Number> { 
+class SimpleClass<N> {// extends Number> { 
  // This is what we are trying to mimic with our ITD
  //public <L extends Number> void m(List<L> ll1, List<N> lz,List<L> ll2) {} 
 }
index 43200dfb299ce6fe8f5a6a2305476fd9b002e55e..5adfad3f636b6bc6616fc79fa3d04f368ed08a63 100644 (file)
@@ -152,22 +152,26 @@ public class GenericsTests extends XMLBasedAjcTestCase {
         * PASS multiple type variables in an ITD
         * PASS parsing ITDs that share type variables with target type
      * PASS using type variables from the target type in your field ITD
-     * TODO using type variables from the target type in your method ITD (but no type vars of your own)
-     * TODO using type variables from the target type in your ctor ITD (but no type vars of your own)
-     * TODO using type variables from the target type in your *STATIC* ITD (field/method/ctor)
-        * TODO binary weaving with changing types (moving between generic and simple)
-        * TODO bridge method creation
-        * TODO reusing type variable letter but differing spec across multiple ITDs in one aspect
+     * PASS using type variables from the target type in your method ITD (but no type vars of your own)
+     * PASS using type variables from the target type in your ctor ITD (but no type vars of your own)
+        * PASS using type variables from the target type and having your own too (methods)
+        * PASS using type variables from the target type and having your own too (ctors)
+        * PASS reusing type variable letter but differing spec across multiple ITDs in one aspect
         * PASS wildcards
-        * TODO exotic class/interface bounds ('? extends List<String>')
         * PASS recursive type variable definitions
-        * TODO generic aspects
-        * TODO parameterizing ITDs with type variables
-        * 
-        * defer?
-        * TODO using type variables from the target type and having your own too (methods)
-        * TODO using type variables from the target type and having your own too (ctors)
+        * PASS generic aspects
+        * PASS parameterizing ITDs with type variables
+     * TODO using type variables from the target type in your *STATIC* ITD (field/method/ctor) (error scenario)
+        * TODO binary weaving with changing types (moving between generic and simple)
+        * TODO bridge method creation (also relates to covariance overrides..)
+        * TODO exotic class/interface bounds ('? extends List<String>','? super anything')
         * TODO signature attributes for generic ITDs (public only?)
+        * TODO generic aspect binary weaving (or at least multi source file weaving)
+        * 
+        * 
+        * strangeness:
+        * 
+        *   adding declare precedence into the itds/binaryweaving A2.aj, A3.aj causes a bizarre classfile inconsistent message
         */
        
        public static Test suite() {
@@ -236,8 +240,8 @@ public class GenericsTests extends XMLBasedAjcTestCase {
        public void testParseItdStaticMethod()    {runTest("Parsing generic ITDs - 2");}
        public void testParseItdCtor()            {runTest("Parsing generic ITDs - 3");}
        public void testParseItdComplexMethod()   {runTest("Parsing generic ITDs - 4");}
-//     public void testParseItdSharingVars1()    {runTest("Parsing generic ITDs - 5");}
-//     public void testParseItdSharingVars2()    {runTest("Parsing generic ITDs - 6");}
+       public void testParseItdSharingVars1()    {runTest("Parsing generic ITDs - 5");}
+       public void testParseItdSharingVars2()    {runTest("Parsing generic ITDs - 6");}
        
        
        // non static
@@ -304,6 +308,74 @@ public class GenericsTests extends XMLBasedAjcTestCase {
        public void testFieldITDsUsingTargetTypeVars15(){runTest("field itd using type variable from target type -15");}
        public void testFieldITDsUsingTargetTypeVars16(){runTest("field itd using type variable from target type -16");}
        
+
+       public void testMethodITDsUsingTargetTypeVarsA1() {runTest("method itd using type variable from target type - A1");}
+       public void testMethodITDsUsingTargetTypeVarsA2() {runTest("method itd using type variable from target type - A2");}
+       public void testMethodITDsUsingTargetTypeVarsA3() {runTest("method itd using type variable from target type - A3");}
+       public void testMethodITDsUsingTargetTypeVarsA4() {runTest("method itd using type variable from target type - A4");}
+       public void testMethodITDsUsingTargetTypeVarsB1() {runTest("method itd using type variable from target type - B1");}
+       public void testMethodITDsUsingTargetTypeVarsC1() {runTest("method itd using type variable from target type - C1");}
+       public void testMethodITDsUsingTargetTypeVarsD1() {runTest("method itd using type variable from target type - D1");}
+       public void testMethodITDsUsingTargetTypeVarsE1() {runTest("method itd using type variable from target type - E1");}
+       public void testMethodITDsUsingTargetTypeVarsF1() {runTest("method itd using type variable from target type - F1");}
+       public void testMethodITDsUsingTargetTypeVarsG1() {runTest("method itd using type variable from target type - G1");}
+       public void testMethodITDsUsingTargetTypeVarsH1() {runTest("method itd using type variable from target type - H1");}
+       public void testMethodITDsUsingTargetTypeVarsI1() {runTest("method itd using type variable from target type - I1");}
+       public void testMethodITDsUsingTargetTypeVarsI2() {runTest("method itd using type variable from target type - I2");}
+       public void testMethodITDsUsingTargetTypeVarsJ1() {runTest("method itd using type variable from target type - J1");}
+       public void testMethodITDsUsingTargetTypeVarsK1() {runTest("method itd using type variable from target type - K1");}
+       public void testMethodITDsUsingTargetTypeVarsL1() {runTest("method itd using type variable from target type - L1");}
+       public void testMethodITDsUsingTargetTypeVarsM1() {runTest("method itd using type variable from target type - M1");}
+       public void testMethodITDsUsingTargetTypeVarsM2() {runTest("method itd using type variable from target type - M2");}
+       public void testMethodITDsUsingTargetTypeVarsN1() {runTest("method itd using type variable from target type - N1");}
+       public void testMethodITDsUsingTargetTypeVarsO1() {runTest("method itd using type variable from target type - O1");}
+       public void testMethodITDsUsingTargetTypeVarsO2() {runTest("method itd using type variable from target type - O2");}
+       public void testMethodITDsUsingTargetTypeVarsP1() {runTest("method itd using type variable from target type - P1");}
+       public void testMethodITDsUsingTargetTypeVarsQ1() {runTest("method itd using type variable from target type - Q1");}
+       
+       public void testCtorITDsUsingTargetTypeVarsA1() {runTest("ctor itd using type variable from target type - A1");}
+       public void testCtorITDsUsingTargetTypeVarsB1() {runTest("ctor itd using type variable from target type - B1");}
+       public void testCtorITDsUsingTargetTypeVarsC1() {runTest("ctor itd using type variable from target type - C1");}
+       public void testCtorITDsUsingTargetTypeVarsD1() {runTest("ctor itd using type variable from target type - D1");}
+       public void testCtorITDsUsingTargetTypeVarsE1() {runTest("ctor itd using type variable from target type - E1");}
+       public void testCtorITDsUsingTargetTypeVarsF1() {runTest("ctor itd using type variable from target type - F1");}
+       public void testCtorITDsUsingTargetTypeVarsG1() {runTest("ctor itd using type variable from target type - G1");}
+       public void testCtorITDsUsingTargetTypeVarsH1() {runTest("ctor itd using type variable from target type - H1");}
+       public void testCtorITDsUsingTargetTypeVarsI1() {runTest("ctor itd using type variable from target type - I1");}
+       
+       public void testSophisticatedAspectsA() {runTest("uberaspects - A");}
+       public void testSophisticatedAspectsB() {runTest("uberaspects - B");}
+       public void testSophisticatedAspectsC() {runTest("uberaspects - C");}
+       public void testSophisticatedAspectsD() {runTest("uberaspects - D");}
+       public void testSophisticatedAspectsE() {runTest("uberaspects - E");}
+       public void testSophisticatedAspectsF() {runTest("uberaspects - F");}
+       public void testSophisticatedAspectsG() {runTest("uberaspects - G");}
+       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
+       public void testSophisticatedAspectsL() {runTest("uberaspects - L");}
+//     public void testSophisticatedAspectsM() {runTest("uberaspects - M");} // FIXME asc needs some error messages writing
+       public void testSophisticatedAspectsN() {runTest("uberaspects - N");}
+//     public void testSophisticatedAspectsO() {runTest("uberaspects - O");} // FIXME asc needs some error messages writing
+       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 testBinaryWeavingITDsA() {runTest("binary weaving ITDs - A");}
+       
+       // ?? Looks like reweavable files dont process their type mungers correctly.
+       // See AjLookupEnvironment.weaveInterTypeDeclarations(SourceTypeBinding,typeMungers,declareparents,...)
+       //   it seems to process any it discovers from the weaver state info then not apply new ones (the ones
+       //   passed in!)
+//     public void testBinaryWeavingITDs1() {runTest("binary weaving ITDs - 1");}
+//     public void testBinaryWeavingITDs2() {runTest("binary weaving ITDs - 2");}
+//     public void testBinaryWeavingITDs3() {runTest("binary weaving ITDs - 3");}
+       
        
        // general tests ... usually just more complex scenarios
        public void testReusingTypeVariableLetters()   {runTest("reusing type variable letters");}
@@ -405,10 +477,6 @@ public class GenericsTests extends XMLBasedAjcTestCase {
 //             runTest("Problems resolving type name inside generic class");
 //     }
        
-       // missing tests in here:
-       
-       // 1. public ITDs and separate compilation - are the signatures correct for the new public members?
-       // 2. ITDF
 
        // -- Pointcut tests...
 
@@ -631,6 +699,7 @@ public class GenericsTests extends XMLBasedAjcTestCase {
                runTest("ajdk notebook: pointcut in generic class example");
        }
        
+       
        // --- helpers
                
        // Check the signature attribute on a class is correct
index 1abf02a21c36c26f048df2277079c6022a038524..4f069aa52492c9715d3f24408e7cdbfc744d31a4 100644 (file)
      </compile>
    </ajc-test>
    
+   <!-- Now intertype declared methods on generic types that use the target types type vars -->
+   
+   <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - A1">
+     <compile files="MethodA.aj" options="-1.5"/>
+     <run class="MethodA"/>   
+   </ajc-test>
+   <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - A2">
+     <compile files="MethodA2.aj" options="-1.5"/>
+     <run class="MethodA2"/>   
+   </ajc-test>
+   <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - A3">
+     <compile files="MethodA3.aj" options="-1.5"/>
+     <run class="MethodA3"/>   
+   </ajc-test>
+   <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - A4">
+     <compile files="MethodA4.aj" options="-1.5"/>
+     <run class="MethodA4"/>   
+   </ajc-test>
+   
+   <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - B1">
+     <compile files="MethodB.aj" options="-1.5">
+       <message kind="error" line="16" text="Incorrect number of type parameters supplied.  The generic type Base&lt;N,M&gt; has 2 type parameters, not 1."/>
+     </compile>
+   </ajc-test>
+    
+   <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - C1">
+     <compile files="MethodC.aj" options="-1.5"/>
+     <run class="MethodC"/>   
+   </ajc-test>
+
+   <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - D1">
+     <compile files="MethodD.aj" options="-1.5"/>
+     <run class="MethodD"/>   
+   </ajc-test>
+
+   <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - E1">
+     <compile files="MethodE.aj" options="-1.5"/>
+     <run class="MethodE"/>   
+   </ajc-test>
+   
+   <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - F1">
+     <compile files="MethodF.aj" options="-1.5"/>
+     <run class="MethodF"/>   
+   </ajc-test>
+   
+   <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - G1">
+     <compile files="MethodG.aj" options="-1.5"/>
+     <run class="MethodG"/>   
+   </ajc-test>
+   
+   <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - H1">
+     <compile files="MethodH.aj" options="-1.5"/>
+     <run class="MethodH"/>   
+   </ajc-test>
+   
+   <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - I1">
+     <compile files="MethodI.aj" options="-1.5">
+       <message kind="error" line="6" text="Type mismatch: cannot convert from List&lt;Integer&gt; to List&lt;String&gt;"/>
+     </compile>
+   </ajc-test>
+   
+   <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - I2">
+     <compile files="MethodI2.aj" options="-1.5">
+       <message kind="error" line="7" text="The method m(List&lt;Integer&gt;) in the type Base&lt;N&gt; is not applicable for the arguments (List&lt;String&gt;)"/>
+     </compile>
+   </ajc-test>
+   
+   <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - J1">
+     <compile files="MethodJ.aj" options="-1.5"/>
+     <run class="MethodJ"/>   
+   </ajc-test>
+   
+   <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - K1">
+     <compile files="MethodK.aj" options="-1.5"/>
+     <run class="MethodK"/>   
+   </ajc-test>
+   
+   <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - L1">
+     <compile files="MethodL.aj" options="-1.5"/>
+     <run class="MethodL"/>   
+   </ajc-test>
+   
+   <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - M1">
+     <compile files="MethodM.aj" options="-1.5"/>
+     <run class="MethodM"/>   
+   </ajc-test>
+   <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - M2">
+     <compile files="MethodM2.aj" options="-1.5"/>
+     <run class="MethodM2"/>   
+   </ajc-test>
+   
+   <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - N1">
+     <compile files="MethodN.aj" options="-1.5">
+            <message kind="error" line="11" text="Type parameters can not be specified in the ITD target type - the target type I is not generic."/>
+     </compile>
+   </ajc-test>
+   
+   <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - O1">
+     <compile files="MethodO.aj" options="-1.5">
+       <message kind="error" line="11" text="Intertype declarations can only be made on the generic type, not on a parameterized type. The name 'String' cannot be used as a type parameter, since it refers to a real type."/>
+     </compile>   
+   </ajc-test>
+   <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - O2">
+     <compile files="MethodO2.aj" options="-1.5">
+       <message kind="error" line="11" text="Intertype declarations can only be made on the generic type, not on a parameterized type. The name 'String' cannot be used as a type parameter, since it refers to a real type."/>
+     </compile>   
+   </ajc-test>  
+   
+   <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - P1">
+     <compile files="MethodP.aj" options="-1.5"/>
+     <run class="MethodP"/>   
+   </ajc-test>
+   
+   <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - Q1">
+     <compile files="MethodQ.aj" options="-1.5"/>
+     <run class="MethodQ"/>   
+   </ajc-test> 
+   
+   <!-- Now intertype declared constructors on generic types that use the target types type vars -->
+   
+   <ajc-test dir="java5/generics/itds/sharing" title="ctor itd using type variable from target type - A1">
+     <compile files="CtorA.aj" options="-1.5"/>
+     <run class="CtorA"/>   
+   </ajc-test> 
+   
+   <ajc-test dir="java5/generics/itds/sharing" title="ctor itd using type variable from target type - B1">
+     <compile files="CtorB.aj" options="-1.5">
+        <message kind="error" line="15" text="Incorrect number of type parameters supplied.  The generic type Base&lt;N,M&gt; has 2 type parameters, not 1."/>
+     </compile>
+   </ajc-test> 
+   
+   <ajc-test dir="java5/generics/itds/sharing" title="ctor itd using type variable from target type - C1">
+     <compile files="CtorC.aj" options="-1.5"/>
+     <run class="CtorC"/>   
+   </ajc-test> 
+     
+   <ajc-test dir="java5/generics/itds/sharing" title="ctor itd using type variable from target type - D1">
+     <compile files="CtorD.aj" options="-1.5"/>
+     <run class="CtorD"/>   
+   </ajc-test> 
+     
+   <ajc-test dir="java5/generics/itds/sharing" title="ctor itd using type variable from target type - E1">
+     <compile files="CtorE.aj" options="-1.5"/>
+     <run class="CtorE"/>   
+   </ajc-test> 
+     
+   <ajc-test dir="java5/generics/itds/sharing" title="ctor itd using type variable from target type - F1">
+     <compile files="CtorF.aj" options="-1.5"/>
+     <run class="CtorF"/>   
+   </ajc-test> 
+     
+   <ajc-test dir="java5/generics/itds/sharing" title="ctor itd using type variable from target type - G1">
+     <compile files="CtorG.aj" options="-1.5"/>
+     <run class="CtorG"/>   
+   </ajc-test> 
+     
+   <ajc-test dir="java5/generics/itds/sharing" title="ctor itd using type variable from target type - H1">
+     <compile files="CtorH.aj" options="-1.5"/>
+     <run class="CtorH"/>   
+   </ajc-test> 
+     
+   <ajc-test dir="java5/generics/itds/sharing" title="ctor itd using type variable from target type - I1">
+     <compile files="CtorI.aj" options="-1.5"/>
+     <run class="CtorI"/>   
+   </ajc-test> 
+   <!-- putting it all together, fields/methods/ctors and decps -->    
+  
+   <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - A">
+     <compile files="GenericAspectA.aj" options="-1.5"/>
+     <run class="GenericAspectA"/>
+   </ajc-test>
+   <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - B">
+     <compile files="GenericAspectB.aj" options="-1.5"/>
+     <run class="GenericAspectB"/>
+   </ajc-test>
+   <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - C">
+     <compile files="GenericAspectC.aj" options="-1.5"/>
+     <run class="GenericAspectC"/>
+   </ajc-test>
+   <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - D">
+     <compile files="GenericAspectD.aj" options="-1.5"/>
+     <run class="GenericAspectD"/>
+   </ajc-test>
+   <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - E">
+     <compile files="GenericAspectE.aj" options="-1.5"/>
+     <run class="GenericAspectE"/>
+   </ajc-test>
+   <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - F">
+     <compile files="GenericAspectF.aj" options="-1.5"/>
+     <run class="GenericAspectF"/>
+   </ajc-test>
+   <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - G">
+     <compile files="GenericAspectG.aj" options="-1.5"/>
+     <run class="GenericAspectG"/>
+   </ajc-test>
+   <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - H">
+     <compile files="GenericAspectH.aj" options="-1.5">
+       <message kind="error" line="7" text="Type java.lang.String does not meet the specification for type parameter 1 (N extends java.lang.Number) in generic type GenericAspect$SimpleI"/>
+       <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 - I">
+     <compile files="GenericAspectI.aj" options="-1.5"/>
+     <run class="GenericAspectI"/>
+   </ajc-test>
+   <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - J">
+     <compile files="GenericAspectJ.aj" options="-1.5"/>
+     <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"/>
+   </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"/>
+   </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"/>
+   </ajc-test>
+   <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - P">
+     <compile files="GenericAspectP.aj" options="-1.5"/>
+     <run class="GenericAspectP"/>
+   </ajc-test>
+   <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - Q">
+     <compile files="GenericAspectQ.aj" options="-1.5"/>
+     <run class="GenericAspectQ"/>
+   </ajc-test>
+   <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - R">
+     <compile files="GenericAspectR.aj" options="-1.5"/>
+     <run class="GenericAspectR"/>
+   </ajc-test>
+   <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - S">
+     <compile files="GenericAspectS.aj" options="-1.5"/>
+     <run class="GenericAspectS"/>
+   </ajc-test>
+   <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - T">
+     <compile files="GenericAspectT.aj" options="-1.5"/>
+   </ajc-test>
+   <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - U">
+     <compile files="GenericAspectU.aj" options="-1.5"/>
+     <run class="GenericAspectU"/>
+   </ajc-test>
+      
+   
+   
    <ajc-test dir="java5/generics/itds/sharing" title="method itd sharing type variable with generic type">
      <compile files="Simple.aj" options="-1.5"/>
      <run class="Simple"/>
    </ajc-test>
    
    <ajc-test dir="java5/generics/itds" title="Parsing generic ITDs - 5">
-     <compile files="Parse5.java" options="-1.5"/>
+     <compile files="Parse5.java" options="-1.5">
+       <message kind="error" line="11" text="Incorrect number of type parameters supplied.  The generic type Parse5&lt;T,S&gt; has 2 type parameters, not 3."/>
+       <message kind="error" line="13" text="Incorrect number of type parameters supplied.  The generic type Parse5&lt;T,S&gt; has 2 type parameters, not 1."/>
+       <message kind="error" line="15" text="Intertype declarations can only be made on the generic type, not on a parameterized type. The name 'String' cannot be used as a type parameter, since it refers to a real type."/>
+     </compile>
    </ajc-test>
    
    <ajc-test dir="java5/generics/itds" title="Parsing generic ITDs - 6">
    
    <!-- generics/itds and binary weaving -->
    
+   <ajc-test dir="java5/generics/itds/binaryweaving" vm="1.5" title="binary weaving ITDs - A">
+          <compile files="TestA_generictype.java" outjar="code.jar" options="-1.5,-Xreweavable"/>
+       <compile files="TestA_aspect.aj,TestA_class.java" inpath="code.jar" options="-1.5,-Xreweavable"/>
+       <run class="TestA_class"/>
+    </ajc-test>
+    
    <ajc-test dir="java5/generics/itds/binaryweaving" vm="1.5" title="binary weaving ITDs - 1">
           <compile files="BaseClass.java" outjar="code.jar" options="-1.5,-Xreweavable"/>
        <compile files="A1.aj" inpath="code.jar" options="-1.5,-Xreweavable"/>
         <run class="BaseClass">
         <stderr>
-             <line text="Advice from A1 ran successfully"/>
+            <line text="Advice count=1"/>
         </stderr>
         </run>
     </ajc-test>
    
    <ajc-test dir="java5/generics/itds/binaryweaving" vm="1.5" title="binary weaving ITDs - 2">
-          <compile files="BaseClass.java,A1.aj" outjar="code.jar" options="-1.5,-Xreweavable"/>
-       <compile files="A2.aj" inpath="code.jar" options="-1.5,-Xreweavable"/>
+          <compile files="BaseClass.java,A1.aj" outjar="code.jar" options="-1.5,-Xreweavable,-showWeaveInfo">
+            <message kind="weave" text="Type 'BaseClass' (BaseClass.java) has intertyped field from 'A1' (A1.aj:'java.util.List BaseClass.list1')"/>
+            <message kind="weave" text="Type 'BaseClass' (BaseClass.java:12) advised by after advice from 'A1' (A1.aj:7)"/>
+          </compile>
+       <compile files="A2.aj" inpath="code.jar" options="-1.5,-Xreweavable,-showWeaveInfo">
+         <message kind="weave" text="Type 'BaseClass' (BaseClass.java) has intertyped field from 'A1' (A1.aj:'java.util.List BaseClass.list1')"/>
+            <message kind="weave" text="Type 'BaseClass' (BaseClass.java:12) advised by after advice from 'A1' (A1.aj:7)"/>
+            <message kind="weave" text="Type 'BaseClass' (BaseClass.java) has intertyped field from 'A2' (A2.aj:'java.util.List BaseClass.list2')"/>
+         <message kind="weave" text="Type 'BaseClass' (BaseClass.java:13) advised by after advice from 'A2' (A2.aj:8)"/>
+       </compile>
         <run class="BaseClass">
         <stderr>
-             <line text="Advice from A1 ran successfully"/>
-             <line text="Advice from A2 ran successfully"/>
+             <line text="Advice count=2"/>
         </stderr>
         </run>
     </ajc-test>
        <compile files="A3.aj" inpath="code.jar" options="-1.5,-Xreweavable"/>
         <run class="BaseClass">
         <stderr>
-             <line text="Advice from A1 ran successfully"/>
-             <line text="Advice from A2 ran successfully"/>
-             <line text="Advice from A3 ran successfully"/>
+             <line text="Advice count=3"/>
         </stderr>
         </run>
     </ajc-test>