diff options
author | jhugunin <jhugunin> | 2003-09-10 00:35:18 +0000 |
---|---|---|
committer | jhugunin <jhugunin> | 2003-09-10 00:35:18 +0000 |
commit | d78d9ed48963cf302c26daab6af782d9b01ea3ac (patch) | |
tree | 73e1aaa7c847dac6ab50d3dd36f1bb62fbd5edd4 /tests | |
parent | d9b32bb20a67995c994a45857d1f16ae84041a1b (diff) | |
download | aspectj-d78d9ed48963cf302c26daab6af782d9b01ea3ac.tar.gz aspectj-d78d9ed48963cf302c26daab6af782d9b01ea3ac.zip |
fix and tests for at least 2 bugs:
Bugzilla Bug 42740
declare error fails on pointcuts composed from multiple classes
Bugzilla Bug 42746
within() pcd is confused for certain declare softs
and probably:
Bugzilla Bug 42739
Compiler crash in ajc head (post 1.1.1 rc1)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ajcTests.xml | 15 | ||||
-rw-r--r-- | tests/bugs/declareBinding/SampleExceptionHandling1.java | 21 | ||||
-rw-r--r-- | tests/bugs/declareSoftWithin/aspects/Softener.aj | 18 | ||||
-rw-r--r-- | tests/bugs/declareSoftWithin/test/NoSoftener.java | 27 |
4 files changed, 81 insertions, 0 deletions
diff --git a/tests/ajcTests.xml b/tests/ajcTests.xml index fc5537889..a50e6940d 100644 --- a/tests/ajcTests.xml +++ b/tests/ajcTests.xml @@ -6736,4 +6736,19 @@ <compile files="InterPerCall.java"/> <run class="InterPerCall"/> </ajc-test> + + <ajc-test dir="bugs/declareBinding" + pr="42740" + title="declare error fails on pointcuts composed from multiple classes"> + <compile files="SampleExceptionHandling1.java"> + <message line="2" kind="error" text="no checked exceptions"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/declareSoftWithin" + pr="42740" + title="declare error fails on pointcuts composed from multiple classes"> + <compile files="aspects/Softener.aj,test/NoSoftener.java"/> + <run class="test.NoSoftener"/> + </ajc-test> </suite> diff --git a/tests/bugs/declareBinding/SampleExceptionHandling1.java b/tests/bugs/declareBinding/SampleExceptionHandling1.java new file mode 100644 index 000000000..4b5e4ae48 --- /dev/null +++ b/tests/bugs/declareBinding/SampleExceptionHandling1.java @@ -0,0 +1,21 @@ +public class SampleExceptionHandling1 { + public void mumble() throws java.io.IOException { } // CE expected +} + + +/** @author Ron Bodkin */ +aspect Library { + public pointcut executionsThrowingChecked() : + execution(* *(..) throws (Exception+ && !RuntimeException)); +} + +/** @author Ron Bodkin */ +aspect SampleExceptionHandling { + public pointcut scope() : within(SampleExceptionHandling1); + + public pointcut executionsThrowingChecked() : + Library.executionsThrowingChecked() && scope(); + + declare error : executionsThrowingChecked(): + "no checked exceptions"; +}
\ No newline at end of file diff --git a/tests/bugs/declareSoftWithin/aspects/Softener.aj b/tests/bugs/declareSoftWithin/aspects/Softener.aj new file mode 100644 index 000000000..21eee34b6 --- /dev/null +++ b/tests/bugs/declareSoftWithin/aspects/Softener.aj @@ -0,0 +1,18 @@ +package aspects;
+
+import test.NoSoftener;
+
+/**
+ * @author Ron Bodkin
+ * @author Jim Hugunin
+ */
+public aspect Softener extends SoftLib {
+ public pointcut scope() : within(NoSoftener);
+}
+
+abstract aspect SoftLib {
+ abstract pointcut scope();
+
+ public pointcut callsThrowingChecked() : call(* *(..)) && scope();
+ declare soft: NoSuchMethodException: callsThrowingChecked();
+}
\ No newline at end of file diff --git a/tests/bugs/declareSoftWithin/test/NoSoftener.java b/tests/bugs/declareSoftWithin/test/NoSoftener.java new file mode 100644 index 000000000..5d082c199 --- /dev/null +++ b/tests/bugs/declareSoftWithin/test/NoSoftener.java @@ -0,0 +1,27 @@ +package test; +import java.lang.reflect.Constructor; +import org.aspectj.testing.Tester; + +/** + * @author Ron Bodkin + * @author Jim Hugunin + */ +public class NoSoftener { + public static void main(String[] args) { + Throwable wrapped = null; + try { + new NoSoftener().foo(Integer.class); + } catch (org.aspectj.lang.SoftException se) { + wrapped = se.getWrappedThrowable(); + } + Tester.checkNonNull(wrapped, "exception thrown"); + Tester.check(wrapped instanceof NoSuchMethodException, + "must be NoSuchMethodException"); + + } + + public void foo(Class clazz) { + Class[] keyArgType = {}; + Constructor ctor = clazz.getConstructor(keyArgType); + } +}
\ No newline at end of file |