From 7746fcb7e977c7a91bd70081a2197a999ec18ad3 Mon Sep 17 00:00:00 2001 From: jhugunin Date: Wed, 12 Mar 2003 23:07:08 +0000 Subject: [PATCH] fix and test for Bugzilla Bug 34858 Weaver crash --- tests/ajcTests.xml | 12 +++++ tests/bugs/CflowBinding.java | 44 +++++++++++++++++++ tests/bugs/CflowBindingOrig.java | 36 +++++++++++++++ tests/jimTests.xml | 12 +++++ .../weaver/patterns/CflowPointcut.java | 5 +++ 5 files changed, 109 insertions(+) create mode 100644 tests/bugs/CflowBinding.java create mode 100644 tests/bugs/CflowBindingOrig.java diff --git a/tests/ajcTests.xml b/tests/ajcTests.xml index b8486e3b5..40998854b 100644 --- a/tests/ajcTests.xml +++ b/tests/ajcTests.xml @@ -5685,4 +5685,16 @@ + + + + + + + + + + diff --git a/tests/bugs/CflowBinding.java b/tests/bugs/CflowBinding.java new file mode 100644 index 000000000..f127811d9 --- /dev/null +++ b/tests/bugs/CflowBinding.java @@ -0,0 +1,44 @@ +// for Bugzilla Bug 34858 +// Weaver crash w/ coverage + +import org.aspectj.testing.Tester; + +public class CflowBinding { + public static void main(String[] args) { + new Bar().bar(10); + } + + + static aspect A { + pointcut flow(int i, Object o): cflow(execution(void bar(int)) && this(o) && args(i)); + + Object around() : call(void m()) && flow(int, Object) { + return proceed(); + } + + Object around(final int i) : call(void m()) && flow(i, Object) { + System.out.println("i: " + i); + return proceed(i); + } + + Object around(final Object o) : call(void m()) && flow(int, o) { + System.out.println("o: " + o); + return proceed(o); + } + + Object around(final Object o, final int i) : call(void m()) && flow(i, o) { + System.out.println("o: " + o + ", i: " + i); + return proceed(o, i); + } + } +} + +class Bar { + void bar(int i) { + m(); + } + void m() { + System.out.println("m"); + } +} + diff --git a/tests/bugs/CflowBindingOrig.java b/tests/bugs/CflowBindingOrig.java new file mode 100644 index 000000000..cd0f00b9d --- /dev/null +++ b/tests/bugs/CflowBindingOrig.java @@ -0,0 +1,36 @@ +// for Bugzilla Bug 34858 +// Weaver crash + +import org.aspectj.testing.Tester; + +/** + * Almost an exact duplicate of the reported issue + */ +public class CflowBindingOrig { + public static void main(String[] args) { + new Bar().foo(); + } + + static aspect MockProcessing { + pointcut testFlow(final Thread thread) : + cflow(execution(void run()) && this(thread) && within(Thread)); // the within is an optimization + + Object around() : + call(* DummyConfiguration.createRootApplicationModule(..)) && testFlow(Thread) + { + return null; + } + } +} + +class Bar { + void foo() { + DummyConfiguration.createRootApplicationModule(); + } +} + +class DummyConfiguration { + static Object createRootApplicationModule() { + return null; + } +} diff --git a/tests/jimTests.xml b/tests/jimTests.xml index f4adb0f97..c03e61f44 100644 --- a/tests/jimTests.xml +++ b/tests/jimTests.xml @@ -1,7 +1,19 @@ + + + + + + + + + +