diff options
author | aclement <aclement> | 2008-06-17 04:02:05 +0000 |
---|---|---|
committer | aclement <aclement> | 2008-06-17 04:02:05 +0000 |
commit | 11ebdd83e542cc1412a0086bff4389b55c592de9 (patch) | |
tree | 2cb292fbfe23627dd7e10a0d2bd0d60323c49dad /tests | |
parent | da08fc1d9bc4b44aa0a79913e410badb09334d27 (diff) | |
download | aspectj-11ebdd83e542cc1412a0086bff4389b55c592de9.tar.gz aspectj-11ebdd83e542cc1412a0086bff4389b55c592de9.zip |
203367: testcase added
Diffstat (limited to 'tests')
3 files changed, 49 insertions, 0 deletions
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<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!"); + } + } +} 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 @@ <!-- 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"> |