package ex3;

import ch.usi.dag.disl.annotation.Before;
import ch.usi.dag.disl.dynamiccontext.DynamicContext;
import ch.usi.dag.disl.marker.BytecodeMarker;

public class Instrumentation {
    @Before(marker = BytecodeMarker.class, args = "astore", scope = "ex3.MainThread.checkAccess")
    static void printVariable(final DynamicContext dc) {
        if ("granted".equals(dc.getStackValue(0, Object.class))) {
            System.out.printf("Thread: %s\n", Thread.currentThread().getName());
        }
    }
}
