Commit 11d42b0e authored by Yudi Zheng's avatar Yudi Zheng

Test case for @SyntheticStaticField

parent 79e85263
package ch.usi.dag.disl.test.staticfield;
import ch.usi.dag.disl.annotation.AfterReturning;
import ch.usi.dag.disl.annotation.Before;
import ch.usi.dag.disl.annotation.SyntheticStaticField;
import ch.usi.dag.disl.annotation.SyntheticStaticField.Scope;
import ch.usi.dag.disl.marker.BodyMarker;
import ch.usi.dag.disl.staticcontext.MethodStaticContext;
public class DiSLClass {
@SyntheticStaticField(scope = Scope.PERCLASS)
public static String s;
@SyntheticStaticField(scope = Scope.PERMETHOD)
public static String mid;
@Before(marker = BodyMarker.class, scope = "TargetClass.*", order = 2)
public static void precondition(MethodStaticContext msc) {
mid = msc.thisMethodFullName();
System.out.println("Entering " + mid + " while s is " + s);
}
@AfterReturning(marker = BodyMarker.class, scope = "TargetClass.*", order = 2)
public static void postcondition() {
System.out.println("Exiting " + mid + " while s is " + s);
}
@Before(marker = BodyMarker.class, scope = "TargetClass.print", order = 1)
public static void precondition2() {
s = "Set in TargetClass.print";
}
}
Manifest-Version: 1.0
DiSL-Classes: ch.usi.dag.disl.test.staticfield.DiSLClass
\ No newline at end of file
package ch.usi.dag.disl.test.staticfield;
public class TargetClass {
public void print() {
System.out.println("This is the body of TargetClass.print");
}
public static void main(String[] args) {
TargetClass t = new TargetClass();
t.print();
}
}
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