From db2886b91cdf010e729f5be3210b5abcfe73e4f0 Mon Sep 17 00:00:00 2001 From: wisberg Date: Wed, 21 May 2003 00:37:47 +0000 Subject: [PATCH] @testcase PR#37898 advice on handler join points should not throw unpermitted checked exceptions --- tests/ajcTestsFailing.xml | 9 +++++++ tests/bugs/handlers/ExceptionCheckCE.java | 30 +++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 tests/bugs/handlers/ExceptionCheckCE.java diff --git a/tests/ajcTestsFailing.xml b/tests/ajcTestsFailing.xml index c86d694bf..260581ad4 100644 --- a/tests/ajcTestsFailing.xml +++ b/tests/ajcTestsFailing.xml @@ -47,4 +47,13 @@ + + + + + + + + diff --git a/tests/bugs/handlers/ExceptionCheckCE.java b/tests/bugs/handlers/ExceptionCheckCE.java new file mode 100644 index 000000000..476b2adec --- /dev/null +++ b/tests/bugs/handlers/ExceptionCheckCE.java @@ -0,0 +1,30 @@ + + +public class ExceptionCheckCE { + + void go() { + try { + String s = new String("hello"); + } catch (RuntimeException e) { // CW 8: pointcut works, but can't throw Exceptions + // body of handler here + if (null == e) { + throw new Error("never happens"); + } + } + } +} + +/** @testcase PR#37898 advice on handler join points should not throw unpermitted checked exceptions */ +aspect A { + + pointcut goHandler() : + handler(RuntimeException) && withincode(void go()); + + declare warning : goHandler() : "expected warning"; // just verifying pointcut + + before() throws Exception : goHandler() { // CE 25 can't throw from handler + throw new Exception("bad"); + } + +} + \ No newline at end of file -- 2.39.5