From 11ebdd83e542cc1412a0086bff4389b55c592de9 Mon Sep 17 00:00:00 2001 From: aclement Date: Tue, 17 Jun 2008 04:02:05 +0000 Subject: [PATCH] 203367: testcase added --- ...chOnInterfaceIntroducedToGenericClass.java | 43 +++++++++++++++++++ .../systemtest/ajc161/Ajc161Tests.java | 1 + .../org/aspectj/systemtest/ajc161/ajc161.xml | 5 +++ 3 files changed, 49 insertions(+) create mode 100644 tests/bugs161/pr203367/CantMatchOnInterfaceIntroducedToGenericClass.java diff --git a/tests/bugs161/pr203367/CantMatchOnInterfaceIntroducedToGenericClass.java b/tests/bugs161/pr203367/CantMatchOnInterfaceIntroducedToGenericClass.java new file mode 100644 index 000000000..57414001c --- /dev/null +++ b/tests/bugs161/pr203367/CantMatchOnInterfaceIntroducedToGenericClass.java @@ -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 { + public void doit(T t) { + System.out.println("doit(): 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().doit(new Integer(2)); + if (mCount!=2) { + throw new RuntimeException("Did not hit marker+ advice twice!"); + } + } +} diff --git a/tests/src/org/aspectj/systemtest/ajc161/Ajc161Tests.java b/tests/src/org/aspectj/systemtest/ajc161/Ajc161Tests.java index b1bc184c2..067301987 100644 --- a/tests/src/org/aspectj/systemtest/ajc161/Ajc161Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc161/Ajc161Tests.java @@ -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"); } diff --git a/tests/src/org/aspectj/systemtest/ajc161/ajc161.xml b/tests/src/org/aspectj/systemtest/ajc161/ajc161.xml index e11ded1bb..774bf391a 100644 --- a/tests/src/org/aspectj/systemtest/ajc161/ajc161.xml +++ b/tests/src/org/aspectj/systemtest/ajc161/ajc161.xml @@ -3,6 +3,11 @@ + + + + + -- 2.39.5