Commit 23061bdd authored by Lukáš Marek's avatar Lukáš Marek

Compilation fix

Static analysis still does not work
Added AbstractStaticAnalysis parent for all static analysis classes
parent 1e6fd17a
......@@ -113,7 +113,7 @@ public class ProcessorHack {
public static Object pseudoVar(ClassNode clazz, MethodNode method,
String owner, String name){
if (owner.equals("ch/usi/dag/disl/staticinfo/analysis/TargetInfo")){
if (owner.equals("ch/usi/dag/disl/staticinfo/analysis/ContextInfo")){
if (name.equals("getFullName")){
return clazz.name + "." + method.name;
......
package ch.usi.dag.disl.staticinfo.analysis;
abstract public class AbstractStaticAnalysis implements StaticAnalysis {
protected StaticAnalysisInfo staticAnalysisInfo;
@Override
public void setStaticAnalysisInfo(StaticAnalysisInfo sai) {
// TODO ! analysis - implement caching
staticAnalysisInfo = sai;
}
}
package ch.usi.dag.disl.staticinfo.analysis;
public class BytcodeAnalysis implements StaticAnalysis {
public class BytcodeAnalysis extends AbstractStaticAnalysis {
int getNumberOfBytecodes(StaticAnalysisInfo ai) {
public int getNumberOfBytecodes() {
// TODO compute number of byte codes in a marked region
// compute range from start to most further end
......
package ch.usi.dag.disl.staticinfo.analysis;
import ch.usi.dag.disl.util.Constants;
public class ContextInfo extends AbstractStaticAnalysis {
public String getMethodName() {
return staticAnalysisInfo.getMethodNode().name;
}
public String getClassName() {
return staticAnalysisInfo.getClassNode().name;
}
public String getFullName() {
return staticAnalysisInfo.getClassNode().name
+ Constants.STATIC_ANALYSIS_METHOD_DELIM
+ staticAnalysisInfo.getMethodNode().name;
}
}
......@@ -4,7 +4,7 @@ public interface StaticAnalysis {
// It is mandatory to implement this interface
public void setStaticAnalysisInfo(StaticAnalysisInfo ai);
public void setStaticAnalysisInfo(StaticAnalysisInfo sai);
// NOTE: all static analysis methods should follow convention:
// a) static analysis methods does not have parameters
......
package ch.usi.dag.disl.staticinfo.analysis;
import ch.usi.dag.disl.util.Constants;
public class TargetInfo implements StaticAnalysis {
public static String getMethodName(StaticAnalysisInfo ai) {
return ai.getMethodNode().name;
}
public static String getClassName(StaticAnalysisInfo ai) {
return ai.getClassNode().name;
}
public static String getFullName(StaticAnalysisInfo ai) {
return ai.getClassNode().name + Constants.STATIC_ANALYSIS_METHOD_DELIM
+ ai.getMethodNode().name;
}
}
......@@ -5,7 +5,7 @@ import ch.usi.dag.disl.annotation.AfterReturning;
import ch.usi.dag.disl.annotation.Before;
import ch.usi.dag.disl.annotation.SyntheticLocal;
import ch.usi.dag.disl.snippet.marker.BodyMarker;
import ch.usi.dag.disl.staticinfo.analysis.TargetInfo;
import ch.usi.dag.disl.staticinfo.analysis.ContextInfoo;
public class DiSLClass {
......@@ -67,7 +67,7 @@ public class DiSLClass {
@Before(marker = BodyMarker.class, order = 0, scope = "TargetClass.*")
public static void preCondition() {
System.out.println("Method " + TargetInfo.getMethodName(null) + ":");
System.out.println("Method " + ContextInfo.getMethodName(null) + ":");
System.out.println(flag);
}
......@@ -75,6 +75,6 @@ public class DiSLClass {
public static void postCondition() {
System.out.println("Again");
System.out.println(flag);
System.out.println("This is the end of " + TargetInfo.getMethodName(null));
System.out.println("This is the end of " + ContextInfo.getMethodName(null));
}
}
......@@ -2,13 +2,13 @@ package ch.usi.dag.disl.test.pseudo;
import ch.usi.dag.disl.annotation.Before;
import ch.usi.dag.disl.snippet.marker.BodyMarker;
import ch.usi.dag.disl.staticinfo.analysis.TargetInfo;
import ch.usi.dag.disl.staticinfo.analysis.ContextInfoo;
public class DiSLClass {
@Before(marker = BodyMarker.class, scope = "TargetClass.this_is_a_method_name", order = 0)
public static void precondition() {
String mid = TargetInfo.getMethodName(null);
String mid = ContextInfo.getMethodName(null);
System.out.println(mid);
}
}
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