]> source.dussan.org Git - aspectj.git/commitdiff
Tests for 98320, 99228, 99089: [generics][itds]
authoraclement <aclement>
Tue, 14 Jun 2005 13:58:09 +0000 (13:58 +0000)
committeraclement <aclement>
Tue, 14 Jun 2005 13:58:09 +0000 (13:58 +0000)
tests/bugs150/PR98320.aj [new file with mode: 0644]
tests/bugs150/PR99228.aj [new file with mode: 0644]
tests/bugs150/pr99089/DataClass.java
tests/bugs150/pr99089/TracingAspect.java
tests/src/org/aspectj/systemtest/ajc150/ajc150.xml

diff --git a/tests/bugs150/PR98320.aj b/tests/bugs150/PR98320.aj
new file mode 100644 (file)
index 0000000..ad07cd9
--- /dev/null
@@ -0,0 +1,18 @@
+import java.util.*;
+
+class C {
+  Set<String> simple_local;
+  Set<Set<String>> nested_local;
+}
+
+aspect Inter_Type_Injector {
+  Set<String> C.simple_intertype;
+  Set<Set<String>> C.nested_intertype;
+
+  public void test() {
+    Set<String> simple_local = new C().simple_local; // works
+    Set<String> simple_intertype = new C().simple_intertype; // works
+    Set<Set<String>> nested_local = new C().nested_local; // works
+    Set<Set<String>> nested_intertype = new C().nested_intertype; // fails
+  }
+}
diff --git a/tests/bugs150/PR99228.aj b/tests/bugs150/PR99228.aj
new file mode 100644 (file)
index 0000000..78288c9
--- /dev/null
@@ -0,0 +1,22 @@
+class Normal { int basicField;}
+class Generic<T> { int basicField;}
+
+aspect Injector {
+  void Normal.method() {}
+  void Generic.method() {}
+  int Normal.itdField;
+  int Generic.itdField;
+
+  void test() {
+    new Normal().method();
+    new Generic<Integer>().method(); 
+       
+    int n1     = new Normal().basicField;
+    int normal = new Normal().itdField;
+
+    int a = new Generic<Integer>().basicField; 
+    int b = new Generic<Integer>().itdField; 
+    int c = new Generic().basicField;
+    int d = new Generic().itdField; 
+  }
+}
index cbfb7905d598806d58641b6d8368f18c99dbd426..91e76763d2993d6ae1f16e54e141fbc6ea808b23 100644 (file)
@@ -1,6 +1,16 @@
 import java.util.Vector;
 
 public class DataClass {
-       private Vector<Object> v = new Vector<Object>();
-       private Vector<Object> getV() { return v; }
+  private Vector<Object> v = new Vector<Object>();
+  private Vector<Object> getV() { return v; }
+
+  public static void main(String[]argv) {
+    DataClass dc = new DataClass();
+    dc.v.add("hello");
+    dc.doit();
+  }
+
+  public void doit() {
+    v.add("world");
+  }
 }
index ba3ef7ef635cf046a8fef71d3a5731ad55ea9362..f318797bf5e41ab06eb0b881b8b07e01415cab3a 100644 (file)
@@ -1,7 +1,12 @@
 import java.util.Vector;
 
 privileged aspect TracingAspect {
-       before(DataClass dc): execution(* DataClass.doit()) && this(dc) {
-               Vector<Object> myV = dc.getV();
-       }
+  before(DataClass dc): execution(* DataClass.doit()) && this(dc) {
+    Vector<Object> myV = dc.getV();
+    System.err.println("before:Length of v="+myV.size());
+  }
+  after(DataClass dc): execution(* DataClass.doit()) && this(dc) {
+    Vector<Object> myV = dc.getV();
+    System.err.println("after:Length of v="+myV.size());
+  }
 }
index eab14b2b3973b0749cc5338c92f651ea2674b0e7..00ab89eb90383f84445e68420f6939d996701c37 100644 (file)
         <run class="B"/>
     </ajc-test>
     
+    <ajc-test dir="bugs150" pr="99228" vm="1.5" title="ITD of a field into a generic class">
+        <compile files="PR99228.aj" options="-1.5"/>
+    </ajc-test>
+    
+    <ajc-test dir="bugs150" pr="98320" vm="1.5" title="intertype with nested generic type">
+        <compile files="PR98320.aj" options="-1.5"/>
+    </ajc-test>
+    
     <ajc-test dir="decs" pr="42743" title="declare soft of runtime exception">
         <compile files="DeclareSoftRuntimeException.aj">
             <message kind="warning" line="3" text="MyRuntimeException will not be softened as it is already a RuntimeException"/>
     
     <ajc-test dir="bugs150/pr99089" vm="1.5" pr="99089" title="ArrayIndexOutOfBoundsException - Generics in privileged aspects">
         <compile files="DataClass.java,TracingAspect.java" options="-1.5"/>
+        <run class="DataClass">
+          <stderr>
+          <line text="before:Length of v=1"/>
+          <line text="after:Length of v=2"/>
+          </stderr>
+        </run>
     </ajc-test>
     
     <ajc-test dir="bugs150" pr="79554" title="Return in try-block disables catch-block if final-block is present">