diff options
author | aclement <aclement> | 2006-04-27 07:06:30 +0000 |
---|---|---|
committer | aclement <aclement> | 2006-04-27 07:06:30 +0000 |
commit | c5c18aaea1700d75e8f92a530133ae371924f33c (patch) | |
tree | f5e6720b7f93cedeb33b4931ff224d415e0b01bf /tests/bugs152/pr138798 | |
parent | c667bcb5088379d74b89c3dc8556b87429e4efb7 (diff) | |
download | aspectj-c5c18aaea1700d75e8f92a530133ae371924f33c.tar.gz aspectj-c5c18aaea1700d75e8f92a530133ae371924f33c.zip |
test for 138798
Diffstat (limited to 'tests/bugs152/pr138798')
-rw-r--r-- | tests/bugs152/pr138798/ErrorHandling.aj | 41 |
1 files changed, 41 insertions, 0 deletions
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; + } + } + +} |