dislproj: done ex3

This commit is contained in:
Claudio Maggioni 2023-01-02 15:59:03 +01:00
parent 6274bebf70
commit 6f3012cf9e

View file

@ -1,4 +1,15 @@
package ex3;
import ch.usi.dag.disl.annotation.Before;
import ch.usi.dag.disl.dynamiccontext.DynamicContext;
import ch.usi.dag.disl.marker.BytecodeMarker;
import ch.usi.dag.disl.staticcontext.InstructionStaticContext;
public class Instrumentation {
@Before(marker = BytecodeMarker.class, args = "astore", scope = "ex3.MainThread.checkAccess")
static void printVariable(final InstructionStaticContext isc, final DynamicContext dc) {
if ("granted".equals(dc.getStackValue(0, Object.class))) {
System.out.printf("Thread: %s\n", Thread.currentThread().getName());
}
}
}