Procházet zdrojové kódy

test for 138798

tags/V1_5_2rc1
aclement před 18 roky
rodič
revize
c5c18aaea1

+ 41
- 0
tests/bugs152/pr138798/ErrorHandling.aj Zobrazit soubor

@@ -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;
}
}

}

+ 1
- 0
tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java Zobrazit soubor

@@ -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");}

+ 9
- 0
tests/src/org/aspectj/systemtest/ajc152/ajc152.xml Zobrazit soubor

@@ -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)"/>

Načítá se…
Zrušit
Uložit