From c5c18aaea1700d75e8f92a530133ae371924f33c Mon Sep 17 00:00:00 2001 From: aclement Date: Thu, 27 Apr 2006 07:06:30 +0000 Subject: test for 138798 --- tests/bugs152/pr138798/ErrorHandling.aj | 41 +++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 tests/bugs152/pr138798/ErrorHandling.aj (limited to 'tests/bugs152') diff --git a/tests/bugs152/pr138798/ErrorHandling.aj b/tests/bugs152/pr138798/ErrorHandling.aj new file mode 100644 index 000000000..0b07335f4 --- /dev/null +++ b/tests/bugs152/pr138798/ErrorHandling.aj @@ -0,0 +1,41 @@ +import org.aspectj.lang.JoinPoint.StaticPart; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +//@Retention(RetentionPolicy.RUNTIME) +@interface NormalException { + /** The default of Void means ANY throwable */ + Class[] value() default Void.class; +} + +public aspect ErrorHandling { + + before(Throwable throwable) : handler(*) && args(throwable) && !@withincode(NormalException) { + System.err.println("Caught in "+thisEnclosingJoinPointStaticPart.getSignature().getName()); + } + + public static void main(String argz[]) { + new Test().checkConnection(); + } +} + +class Test { + @NormalException(Exception.class) + protected void checkConnection() { + try { + foo(); + } catch (Exception e) { + ;//skip warning + } + } + + private void foo() { + try { + throw new RuntimeException(); + } catch (RuntimeException e) { + throw e; + } + } + +} -- cgit v1.2.3