aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/bugs')
-rw-r--r--tests/bugs/declareBinding/SampleExceptionHandling1.java21
-rw-r--r--tests/bugs/declareSoftWithin/aspects/Softener.aj18
-rw-r--r--tests/bugs/declareSoftWithin/test/NoSoftener.java27
3 files changed, 66 insertions, 0 deletions
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