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 | |
parent | c667bcb5088379d74b89c3dc8556b87429e4efb7 (diff) | |
download | aspectj-c5c18aaea1700d75e8f92a530133ae371924f33c.tar.gz aspectj-c5c18aaea1700d75e8f92a530133ae371924f33c.zip |
test for 138798
-rw-r--r-- | tests/bugs152/pr138798/ErrorHandling.aj | 41 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java | 1 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc152/ajc152.xml | 9 |
3 files changed, 51 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; + } + } + +} diff --git a/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java b/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java index 261cc4f8b..a89421cda 100644 --- a/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java @@ -32,6 +32,7 @@ public class Ajc152Tests extends org.aspectj.testing.XMLBasedAjcTestCase { public void testStackOverflow_pr136258() { runTest("stack overflow");} public void testIncorrectOverridesEvaluation13() { runTest("incorrect overrides evaluation - 1.3"); } public void testIncorrectOverridesEvaluation15() { runTest("incorrect overrides evaluation - 1.5"); } + public void testAtWithinCodeBug_pr138798() { runTest("atWithinCodeBug"); } // known failures, uncomment when working. public void testReferencePCutInDeclareWarning_pr138215() { runTest("Reference pointcut fails inside @DeclareWarning");} diff --git a/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml b/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml index 0d49de371..b9ab6e947 100644 --- a/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml +++ b/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml @@ -20,6 +20,15 @@ <run class="StatisticsTypeImpl"/> </ajc-test> + <ajc-test dir="bugs152/pr138798" title="atWithinCodeBug"> + <compile files="ErrorHandling.aj" options="-1.5"/> + <run class="ErrorHandling"> + <stderr> + <line text="Caught in foo"/> + </stderr> + </run> + </ajc-test> + <ajc-test dir="bugs152/pr138158" title="not at withincode - 1"> <compile files="Boo.java" options="-1.5 -showWeaveInfo"> <message kind="weave" text="Join point 'method-call(void Boo.m())' in Type 'Boo' (Boo.java:9) advised by before advice from 'X' (Boo.java:19)"/> |