aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs
diff options
context:
space:
mode:
authorjhugunin <jhugunin>2004-01-28 01:12:17 +0000
committerjhugunin <jhugunin>2004-01-28 01:12:17 +0000
commit19bac866e44563dad29b6bebefa31c4e354ee96c (patch)
tree3f8859dac3e5a8db3d950898ee70f7a45e860775 /tests/bugs
parent6cceb1b9c3b53e92166d61435f28318e2b9a8872 (diff)
downloadaspectj-19bac866e44563dad29b6bebefa31c4e354ee96c.tar.gz
aspectj-19bac866e44563dad29b6bebefa31c4e354ee96c.zip
Test and fix for Bugzilla Bug 50570
CatchClauseSignature has broken operation
Diffstat (limited to 'tests/bugs')
-rw-r--r--tests/bugs/HandlerSig.java42
1 files changed, 42 insertions, 0 deletions
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");
+ }
+}