Commit 2d4489ca authored by Yudi Zheng's avatar Yudi Zheng

test case for getException

parent 815c3655
package ch.usi.dag.disl.test.after4;
import ch.usi.dag.disl.annotation.After;
import ch.usi.dag.disl.annotation.AfterThrowing;
import ch.usi.dag.disl.dynamiccontext.DynamicContext;
import ch.usi.dag.disl.marker.BodyMarker;
public class DiSLClass {
@After(marker = BodyMarker.class, scope = "TargetClass.print(boolean)", order = 0)
public static void after(DynamicContext dc) {
System.out.println("after " + dc.getException());
}
@AfterThrowing(marker = BodyMarker.class, scope = "TargetClass.print(boolean)", order = 1)
public static void afterThrowning(DynamicContext dc) {
System.out.println("afterThrowning " + dc.getException());
}
}
Manifest-Version: 1.0
DiSL-Classes: ch.usi.dag.disl.test.after4.DiSLClass
\ No newline at end of file
package ch.usi.dag.disl.test.after4;
public class TargetClass {
public void print(boolean flag) {
try {
System.out.println("try-clause");
if (flag) {
String float_one = "1.0";
int int_one = Integer.valueOf(float_one);
System.out.println(int_one + "This should not be printed!");
}
System.out.println("normal return");
} finally {
System.out.println("finally-clause");
}
}
public static void main(String[] args) {
TargetClass t = new TargetClass();
System.out.println("=========call print(false)=========");
t.print(false);
System.out.println("=========call print(true) =========");
t.print(true);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment