]> source.dussan.org Git - aspectj.git/commitdiff
203367: testcase added
authoraclement <aclement>
Tue, 17 Jun 2008 04:02:05 +0000 (04:02 +0000)
committeraclement <aclement>
Tue, 17 Jun 2008 04:02:05 +0000 (04:02 +0000)
tests/bugs161/pr203367/CantMatchOnInterfaceIntroducedToGenericClass.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc161/Ajc161Tests.java
tests/src/org/aspectj/systemtest/ajc161/ajc161.xml

diff --git a/tests/bugs161/pr203367/CantMatchOnInterfaceIntroducedToGenericClass.java b/tests/bugs161/pr203367/CantMatchOnInterfaceIntroducedToGenericClass.java
new file mode 100644 (file)
index 0000000..5741400
--- /dev/null
@@ -0,0 +1,43 @@
+package bug;  // I used a "bug" package under the "src" source folder.
+
+public aspect CantMatchOnInterfaceIntroducedToGenericClass {
+        public static interface Marker {}
+        public static class NonGenericClass {
+                public void doit(String msg) {
+                        System.out.println("doit(): msg = "+msg);
+                }
+        }
+        public static class GenericClass<T> {
+                public void doit(T t) {
+                        System.out.println("doit<T>(): t = "+t);
+                }
+        }
+
+        declare parents: NonGenericClass implements Marker;
+        declare parents: GenericClass    implements Marker;
+
+        pointcut nonGenericCall(): call (void NonGenericClass.doit(..));
+        pointcut genericCall():    call (void GenericClass.doit(..));
+        pointcut markerCall():     call (void Marker+.doit(..));
+
+        private static int mCount  = 0;
+        
+        before(): nonGenericCall() {
+                System.out.println("nonGenericCall advice hit");
+        }
+        before(): genericCall() {
+                System.out.println("genericCall advice hit");
+        }
+        before(): markerCall() {
+                       mCount++;
+                System.out.println("markerCall advice hit");
+        }
+
+        public static void main(String args[]) {
+                new NonGenericClass().doit("message1");
+                new GenericClass<Integer>().doit(new Integer(2));
+                if (mCount!=2) {
+                       throw new RuntimeException("Did not hit marker+ advice twice!");
+                }
+        }
+}
index b1bc184c26b4c9f7f495ff4c08469457c874bb27..06730198713399f6f83b4d8c6e63e9e8efa225e0 100644 (file)
@@ -23,6 +23,7 @@ import org.aspectj.testing.XMLBasedAjcTestCase;
 public class Ajc161Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
        
        // AspectJ1.6.1 
+       public void testGenericMarkerMatch_pr203367() { runTest("generic marker match");}
 //     public void testSuperItds_pr134425() { runTest("super itds"); }
        public void testSuperItds_pr198196_1() { runTest("super itds - 2"); }
        public void testSuperItds_pr198196_2() { runTest("super itds - 3"); }
index e11ded1bb7d4380394282998d573d970c2e8d12d..774bf391a65607a44ae8a1fa6befab53f497607d 100644 (file)
@@ -3,6 +3,11 @@
 <!-- AspectJ v1.6.1 Tests -->
 <suite>
 
+       <ajc-test dir="bugs161/pr203367" title="generic marker match">
+       <compile files="CantMatchOnInterfaceIntroducedToGenericClass.java" options="-1.5"/>
+       <run class="bug.CantMatchOnInterfaceIntroducedToGenericClass"/>
+    </ajc-test>
+    
        <ajc-test dir="bugs161/pr198196" title="super itds - 2">
        <compile files="Marker.java Foo.java MarkerAspect2.java"/>
        <run class="Foo">