diff options
author | wisberg <wisberg> | 2003-05-21 00:37:47 +0000 |
---|---|---|
committer | wisberg <wisberg> | 2003-05-21 00:37:47 +0000 |
commit | db2886b91cdf010e729f5be3210b5abcfe73e4f0 (patch) | |
tree | 10351f70e6dc8edb8a794f909713eaaece1732fe /tests/bugs/handlers/ExceptionCheckCE.java | |
parent | fad36b98aaef028c7678206f89a0e8178b360030 (diff) | |
download | aspectj-db2886b91cdf010e729f5be3210b5abcfe73e4f0.tar.gz aspectj-db2886b91cdf010e729f5be3210b5abcfe73e4f0.zip |
@testcase PR#37898 advice on handler join points should not throw unpermitted checked exceptions
Diffstat (limited to 'tests/bugs/handlers/ExceptionCheckCE.java')
-rw-r--r-- | tests/bugs/handlers/ExceptionCheckCE.java | 30 |
1 files changed, 30 insertions, 0 deletions
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 |