From 19bac866e44563dad29b6bebefa31c4e354ee96c Mon Sep 17 00:00:00 2001 From: jhugunin Date: Wed, 28 Jan 2004 01:12:17 +0000 Subject: Test and fix for Bugzilla Bug 50570 CatchClauseSignature has broken operation --- tests/ajcTests.xml | 5 +++++ tests/bugs/HandlerSig.java | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 tests/bugs/HandlerSig.java (limited to 'tests') 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 @@ + + + + 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"); + } +} -- cgit v1.2.3