aboutsummaryrefslogtreecommitdiffstats
path: root/tests/decs
diff options
context:
space:
mode:
authoracolyer <acolyer>2005-03-14 02:17:51 +0000
committeracolyer <acolyer>2005-03-14 02:17:51 +0000
commit204274dc0529ecbbaa20d72eec49a14ddf4ba34c (patch)
tree69ab15251122235278acaf91a2ff9158121870f9 /tests/decs
parente35d9ee62484336a691cfc3990c507c482a2d06a (diff)
downloadaspectj-204274dc0529ecbbaa20d72eec49a14ddf4ba34c.tar.gz
aspectj-204274dc0529ecbbaa20d72eec49a14ddf4ba34c.zip
test cases for Bugzilla Bug 42743: declare soft limitation
Diffstat (limited to 'tests/decs')
-rw-r--r--tests/decs/DeclareSoftRuntimeException.aj41
-rw-r--r--tests/decs/VerifyError.aj23
2 files changed, 64 insertions, 0 deletions
diff --git a/tests/decs/DeclareSoftRuntimeException.aj b/tests/decs/DeclareSoftRuntimeException.aj
new file mode 100644
index 000000000..379ba645c
--- /dev/null
+++ b/tests/decs/DeclareSoftRuntimeException.aj
@@ -0,0 +1,41 @@
+public aspect DeclareSoftRuntimeException {
+
+ declare soft : MyRuntimeException : execution(* *(..));
+ declare soft : MyException : execution(* *(..));
+ declare soft : Exception : execution(void throwMyExceptionButNotReally());
+
+ public static void main(String[] args) {
+ try {
+ throwMyRuntimeException();
+ } catch(Exception ex) {
+ System.out.println(ex.getClass().getName());
+ }
+ try {
+ throwMyException();
+ } catch(Exception ex) {
+ System.out.println(ex.getClass().getName());
+ }
+ try {
+ throwMyExceptionButNotReally();
+ } catch(Exception ex) {
+ System.out.println(ex.getClass().getName());
+ }
+ }
+
+ private static void throwMyRuntimeException() {
+ throw new MyRuntimeException();
+ }
+
+ private static void throwMyException() throws MyException {
+ throw new MyException();
+ }
+
+ private static void throwMyExceptionButNotReally() throws MyException {
+ throw new MyRuntimeException();
+ }
+
+}
+
+class MyRuntimeException extends RuntimeException {}
+
+class MyException extends Exception {}
diff --git a/tests/decs/VerifyError.aj b/tests/decs/VerifyError.aj
new file mode 100644
index 000000000..835748770
--- /dev/null
+++ b/tests/decs/VerifyError.aj
@@ -0,0 +1,23 @@
+import java.io.IOException;
+import org.aspectj.lang.SoftException;
+
+public class VerifyError {
+
+ static void foo() throws IOException {
+ throw new IOException();
+ }
+
+ public static void main(String[] args) throws Exception{
+ try {
+ foo();
+ } catch (SoftException sEx) {
+ //
+ }
+ }
+}
+
+
+aspect Soften {
+
+ declare soft : IOException : call(* foo());
+} \ No newline at end of file