diff options
author | jhugunin <jhugunin> | 2004-01-28 01:12:17 +0000 |
---|---|---|
committer | jhugunin <jhugunin> | 2004-01-28 01:12:17 +0000 |
commit | 19bac866e44563dad29b6bebefa31c4e354ee96c (patch) | |
tree | 3f8859dac3e5a8db3d950898ee70f7a45e860775 /tests | |
parent | 6cceb1b9c3b53e92166d61435f28318e2b9a8872 (diff) | |
download | aspectj-19bac866e44563dad29b6bebefa31c4e354ee96c.tar.gz aspectj-19bac866e44563dad29b6bebefa31c4e354ee96c.zip |
Test and fix for Bugzilla Bug 50570
CatchClauseSignature has broken operation
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ajcTests.xml | 5 | ||||
-rw-r--r-- | tests/bugs/HandlerSig.java | 42 |
2 files changed, 47 insertions, 0 deletions
diff --git a/tests/ajcTests.xml b/tests/ajcTests.xml index 8d17bd6fe..e9ade4e18 100644 --- a/tests/ajcTests.xml +++ b/tests/ajcTests.xml @@ -7136,4 +7136,9 @@ <run class="SubtypeConstructorCW"/> </ajc-test> + <ajc-test dir="bugs" pr="50570" + title="CatchClauseSignature has broken operation"> + <compile files="HandlerSig.java"/> + <run class="HandlerSig"/> + </ajc-test> </suite> diff --git a/tests/bugs/HandlerSig.java b/tests/bugs/HandlerSig.java new file mode 100644 index 000000000..8e644815f --- /dev/null +++ b/tests/bugs/HandlerSig.java @@ -0,0 +1,42 @@ +import org.aspectj.testing.Tester; + +import org.aspectj.lang.reflect.*; + +public class HandlerSig { + + public void doSomething() { + // Get around "unreachable code error... + if (true) + { + throw new BusinessException("Surprise!!"); + } + System.out.println("Busy doing something."); + } + + public static void main(String[] args) { + try { + HandlerSig m = new HandlerSig(); + m.doSomething(); + } catch (BusinessException be) { + Tester.checkEqual(be.getMessage(), "Surprise!!"); + } + } +} + +class BusinessException extends RuntimeException { + BusinessException(String message) { + super(message); + } +} + +aspect AppMonitor { + pointcut problemHandling() : handler(Throwable+); + + before() : problemHandling() { + CatchClauseSignature cSig = + (CatchClauseSignature) thisJoinPointStaticPart.getSignature(); + + Tester.checkEqual(cSig.getParameterType(), BusinessException.class); + Tester.checkEqual(cSig.getParameterName(), "be"); + } +} |