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 | |
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
-rw-r--r-- | tests/ajcTestsFailing.xml | 9 | ||||
-rw-r--r-- | tests/bugs/handlers/ExceptionCheckCE.java | 30 |
2 files changed, 39 insertions, 0 deletions
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 @@ <run class="app.Main"/> </ajc-test> + <ajc-test dir="bugs/handlers" pr="37898" + title="advice on handler join points should not throw unpermitted checked exceptions"> + <compile files="ExceptionCheckCE.java"> + <message kind="warning" line="8" text="expected"/> + <message kind="error" line="25" text="throw checked exception" /> + <message kind="error" line="8" text="throw checked exception" /> + </compile> + </ajc-test> + </suite> 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 |