]> source.dussan.org Git - aspectj.git/commitdiff
more tests - for 115237 and alexs bug on the list.
authoraclement <aclement>
Thu, 17 Nov 2005 08:37:16 +0000 (08:37 +0000)
committeraclement <aclement>
Thu, 17 Nov 2005 08:37:16 +0000 (08:37 +0000)
tests/bugs150/pr115237.aj [new file with mode: 0644]
tests/java5/generics/bugs/lists/case1/IdentifiableAspect.java
tests/java5/generics/bugs/lists/case3/Bean.java [new file with mode: 0644]
tests/java5/generics/bugs/lists/case3/Identifiable.java [new file with mode: 0644]
tests/java5/generics/bugs/lists/case3/IdentifiableAspect.java [new file with mode: 0644]
tests/java5/generics/bugs/lists/case3/LongIdentifiable.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java
tests/src/org/aspectj/systemtest/ajc150/ajc150.xml

diff --git a/tests/bugs150/pr115237.aj b/tests/bugs150/pr115237.aj
new file mode 100644 (file)
index 0000000..f1a019b
--- /dev/null
@@ -0,0 +1,36 @@
+public class pr115237 {
+       public static void main(String[] args) {
+               C c = new C();
+               c.go();
+               A a = A.aspectOf(c);
+               // ok, illegal - aspectOf only on concrete aspects?
+               // AA aa = AA.aspectOf(c);
+
+               // hmm - n/a for parameterized types?
+               BB capt  = BB.aspectOf(c); // unexpected compile error here
+               //System.out.println("A " + a + " capt " + capt);
+       }
+       static class C {
+               void go() {}            
+       }
+       
+       abstract static aspect AA pertarget(pc()) {
+               abstract pointcut pc();
+               before() : pc() {
+                       System.out.println("go()");
+               }
+       }
+       static aspect A extends AA {
+               pointcut pc() : call(void C.go());
+       }
+       
+       abstract static aspect BB<T> pertarget(pc()) {
+               abstract pointcut pc();
+               before() : pc() {
+                       System.out.println("go()");
+               }
+       }
+       static aspect B extends BB<C> {
+               pointcut pc() : call(void C.go());
+       }
+}
index 32fe42390d2178654d4feb407f767825441d7073..7b150fa591a3829d9cf2197eb0f88adb50b768f5 100644 (file)
@@ -12,6 +12,6 @@ public aspect IdentifiableAspect {
     }
 
   public static void main(String []argv) { 
-    new Bean();
+    Bean b = new Bean();
   }
 }
diff --git a/tests/java5/generics/bugs/lists/case3/Bean.java b/tests/java5/generics/bugs/lists/case3/Bean.java
new file mode 100644 (file)
index 0000000..6444e4a
--- /dev/null
@@ -0,0 +1,2 @@
+
+public class Bean {}
diff --git a/tests/java5/generics/bugs/lists/case3/Identifiable.java b/tests/java5/generics/bugs/lists/case3/Identifiable.java
new file mode 100644 (file)
index 0000000..645ee36
--- /dev/null
@@ -0,0 +1,5 @@
+public interface Identifiable<T> {
+  T getId();
+
+  void setId(T t);
+}
diff --git a/tests/java5/generics/bugs/lists/case3/IdentifiableAspect.java b/tests/java5/generics/bugs/lists/case3/IdentifiableAspect.java
new file mode 100644 (file)
index 0000000..a9cb3f7
--- /dev/null
@@ -0,0 +1,20 @@
+public aspect IdentifiableAspect {
+    declare parents: Bean implements LongIdentifiable;
+
+    private Long LongIdentifiable.m_id;
+
+    public Long LongIdentifiable.getId() {
+        return m_id;
+    }
+
+    public void LongIdentifiable.setId(Long id) {
+        m_id= id;
+    }
+
+  public static void main(String []argv) {
+    Bean b = new Bean();
+    b.setId(37L);
+    long l = b.getId();
+    if (l!=37L) throw new RuntimeException("id should be 37");
+  }
+}
diff --git a/tests/java5/generics/bugs/lists/case3/LongIdentifiable.java b/tests/java5/generics/bugs/lists/case3/LongIdentifiable.java
new file mode 100644 (file)
index 0000000..37fa762
--- /dev/null
@@ -0,0 +1,2 @@
+public interface LongIdentifiable extends Identifiable<Long> {
+}
index 7d0865b5fde1a1afa0ccef6aabf5f207375d698a..83c1b59cc6003132c34282cb1957b5fb1ef66adf 100644 (file)
@@ -210,6 +210,7 @@ public class GenericsTests extends XMLBasedAjcTestCase {
        
        public void testGenericsOverrides_1() { runTest("generics and ITD overrides - 1"); }
        public void testGenericsOverrides_2() { runTest("generics and ITD overrides - 2"); }
+       public void testGenericsOverrides_3() { runTest("generics and ITD overrides - 3"); }
        
        public void testPR88606() {
                runTest("Parameterized types on introduced fields not correctly recognized");
index 545495004efccc7747c9e3f32825175824d18eac..971e0ee481ec3c841ae911e115b66bebc5d61111 100644 (file)
           <message kind="error" line="12" text="Cannot make inter-type declarations on type variables"/>
         </compile>
     </ajc-test>
+    
+    <ajc-test dir="bugs150" title="aspectOf and generic aspects">
+        <compile files="pr115237.aj" options="-1.5"/>
+        <run class="pr115237"/>
+    </ajc-test>
 
    <ajc-test dir="bugs150/pr114343/case2" title="field-get, generics and around advice - 2">
       <compile files="Test.java,TTT.java,TestAspect.java" options="-1.5"/>
         <compile files="Identifiable.java,Bean.java,LongIdentifiable.java,IdentifiableAspect.java" options="-1.5">
         </compile>
         <run class="IdentifiableAspect"/>
+    </ajc-test>
+    
+    <ajc-test dir="java5/generics/bugs/lists/case3" title="generics and ITD overrides - 3">
+        <compile files="Identifiable.java,Bean.java,LongIdentifiable.java,IdentifiableAspect.java" options="-1.5">
+        </compile>
+        <run class="IdentifiableAspect"/>
     </ajc-test> 
 
     <!-- Currently a warning doesn't occur if the annotation is already on the field