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/bugs161 | |
parent | da08fc1d9bc4b44aa0a79913e410badb09334d27 (diff) | |
download | aspectj-11ebdd83e542cc1412a0086bff4389b55c592de9.tar.gz aspectj-11ebdd83e542cc1412a0086bff4389b55c592de9.zip |
203367: testcase added
Diffstat (limited to 'tests/bugs161')
-rw-r--r-- | tests/bugs161/pr203367/CantMatchOnInterfaceIntroducedToGenericClass.java | 43 |
1 files changed, 43 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!"); + } + } +} |