Commit 1e39d673 authored by Danilo Ansaloni's avatar Danilo Ansaloni

Added support for the CodeCoverage example.

parent 2cad946d
......@@ -6,7 +6,6 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import ch.usi.dag.disl.test.dispatch.CodeExecuted;
import ch.usi.dag.dislreserver.exception.DiSLREServerFatalException;
import ch.usi.dag.dislreserver.remoteanalysis.RemoteAnalysis;
......@@ -73,30 +72,50 @@ public class AnalysisResolver {
// in compile-test
// - ,compile-dislre-server,compile-dislre-dispatch should be added to dependences
// - no first javac
try {
Object i = CodeExecuted.class.newInstance();
Method m1 = CodeExecuted.class.getMethod("bytecodesExecuted", int.class);
registerMethod(1, new AnalysisMethodHolder((RemoteAnalysis)i, m1));
Method m2 = CodeExecuted.class.getMethod("testingBasic",
Class<? extends RemoteAnalysis> clazz = getClass("ch.usi.dag.disl.test.dispatch.CodeExecuted");
RemoteAnalysis instance = clazz.newInstance();
Method m1 = clazz.getMethod("bytecodesExecuted", int.class);
registerMethod(1, new AnalysisMethodHolder(instance, m1));
Method m2 = clazz.getMethod("testingBasic",
boolean.class, byte.class, char.class, short.class,
int.class, long.class, float.class, double.class);
registerMethod(2, new AnalysisMethodHolder((RemoteAnalysis)i, m2));
Method m3 = CodeExecuted.class.getMethod("testingAdvanced",
registerMethod(2, new AnalysisMethodHolder(instance, m2));
Method m3 = clazz.getMethod("testingAdvanced",
String.class, Object.class, Class.class, int.class);
registerMethod(3, new AnalysisMethodHolder((RemoteAnalysis)i, m3));
Method m4 = CodeExecuted.class.getMethod("testingAdvanced2",
registerMethod(3, new AnalysisMethodHolder(instance, m3));
Method m4 = clazz.getMethod("testingAdvanced2",
Object.class, Object.class, Object.class, Object.class,
Class.class, int.class, Class.class, int.class,
Class.class, int.class, Class.class, int.class);
registerMethod(4, new AnalysisMethodHolder((RemoteAnalysis)i, m4));
registerMethod(4, new AnalysisMethodHolder(instance, m4));
} catch (Exception e) {
System.err.println("[AnalysisResolver.<clinit>] " + e);
System.err.flush();
}
try {
Class<? extends RemoteAnalysis> clazz = getClass("ch.usi.dag.disl.example.codeCov.CodeCoverage");
RemoteAnalysis instance2 = clazz.newInstance();
Method m5 = clazz.getMethod("onConstructor", Class.class);
registerMethod(5, new AnalysisMethodHolder(instance2, m5));
Method m6 = clazz.getMethod("onBB", String.class, int.class);
registerMethod(6, new AnalysisMethodHolder(instance2, m6));
} catch (Exception e) {
e.printStackTrace();
System.err.println("[AnalysisResolver.<clinit>] " + e);
System.err.flush();
}
}
private static Class<? extends RemoteAnalysis> getClass(String className) throws ClassNotFoundException, ClassCastException {
Class<?> clazz = Class.forName(className);
return clazz.asSubclass(RemoteAnalysis.class);
}
}
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