Loading iacfg/pom.xml +1 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ <groupId>es.upv.mist.slicing</groupId> <artifactId>sdg-cli</artifactId> <version>1.3.0</version> <scope>test</scope> </dependency> </dependencies> Loading iacfg/src/main/java/es/upv/mist/slicing/I_ACFG.java +4 −24 Original line number Diff line number Diff line Loading @@ -8,11 +8,8 @@ import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; import com.github.javaparser.ast.body.ConstructorDeclaration; import com.github.javaparser.ast.body.MethodDeclaration; import com.github.javaparser.ast.visitor.VoidVisitorAdapter; import com.github.javaparser.utils.CodeGenerationUtils; import es.upv.mist.slicing.arcs.Arc; import es.upv.mist.slicing.arcs.cfg.ControlFlowArc; import es.upv.mist.slicing.cli.DOTAttributes; import es.upv.mist.slicing.cli.GraphLog; import es.upv.mist.slicing.graphs.CallGraph; import es.upv.mist.slicing.graphs.ClassGraph; import es.upv.mist.slicing.graphs.Graph; Loading @@ -30,7 +27,6 @@ import es.upv.mist.slicing.utils.StaticTypeSolver; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.util.*; import static es.upv.mist.slicing.util.SingletonCollector.toSingleton; Loading @@ -39,18 +35,11 @@ public class I_ACFG extends Graph { protected static final Map<CallableDeclaration<?>, CFG> acfgMap = ASTUtils.newIdentityHashMap(); protected CallGraph callGraph; protected boolean built = false; public static void main(String[] args) throws IOException { String ruta = "/src/main/java/es/upv/mist/slicing/tests/"; String fichero = "Test.java"; I_ACFG iAcfg = new I_ACFG(); iAcfg.generarACFG(ruta, fichero); } public void generarACFG(String ruta, String fichero) throws IOException { public void build(File file) { if (built) return; NodeList<CompilationUnit> units = new NodeList<>(); File file = new File(CodeGenerationUtils.mavenModuleRoot(I_ACFG.class)+ruta+fichero); StaticJavaParser.getConfiguration().setAttributeComments(false); StaticTypeSolver.addTypeSolverJRE(); Loading @@ -68,16 +57,7 @@ public class I_ACFG extends Graph { copyACFGs(); expandCalls(); joinACFGs(); new GraphLog<>(this) { @Override protected DOTAttributes edgeAttributes(Arc arc) { DOTAttributes att = super.edgeAttributes(arc); if (arc.isNonExecutableControlFlowArc()) att.add("style", "dashed"); return att; } }.generateImages("migrafo"); System.out.println("Grafo generado..."); built = true; } protected void buildACFGs(NodeList<CompilationUnit> nodeList) { Loading iacfg/src/test/java/es/upv/mist/slicing/graphs/icfg/IACFGTest.java 0 → 100644 +28 −0 Original line number Diff line number Diff line package es.upv.mist.slicing.graphs.icfg; import es.upv.mist.slicing.I_ACFG; import es.upv.mist.slicing.arcs.Arc; import es.upv.mist.slicing.cli.DOTAttributes; import es.upv.mist.slicing.cli.GraphLog; import java.io.File; import java.io.IOException; public class IACFGTest { public static void main(String[] args) throws IOException { File file = new File(Thread.currentThread().getContextClassLoader().getResource("Test.java").getPath()); I_ACFG icfg = new I_ACFG(); icfg.build(file); new GraphLog<>(icfg) { @Override protected DOTAttributes edgeAttributes(Arc arc) { DOTAttributes att = super.edgeAttributes(arc); if (arc.isNonExecutableControlFlowArc()) att.add("style", "dashed"); return att; } }.generateImages("migrafo"); System.out.println("Grafo generado..."); } } iacfg/src/main/java/es/upv/mist/slicing/tests/Test.java→iacfg/src/test/resources/Test.java +0 −2 Original line number Diff line number Diff line package es.upv.mist.slicing.tests; public class Test { public static int z = 0; Loading Loading
iacfg/pom.xml +1 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ <groupId>es.upv.mist.slicing</groupId> <artifactId>sdg-cli</artifactId> <version>1.3.0</version> <scope>test</scope> </dependency> </dependencies> Loading
iacfg/src/main/java/es/upv/mist/slicing/I_ACFG.java +4 −24 Original line number Diff line number Diff line Loading @@ -8,11 +8,8 @@ import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; import com.github.javaparser.ast.body.ConstructorDeclaration; import com.github.javaparser.ast.body.MethodDeclaration; import com.github.javaparser.ast.visitor.VoidVisitorAdapter; import com.github.javaparser.utils.CodeGenerationUtils; import es.upv.mist.slicing.arcs.Arc; import es.upv.mist.slicing.arcs.cfg.ControlFlowArc; import es.upv.mist.slicing.cli.DOTAttributes; import es.upv.mist.slicing.cli.GraphLog; import es.upv.mist.slicing.graphs.CallGraph; import es.upv.mist.slicing.graphs.ClassGraph; import es.upv.mist.slicing.graphs.Graph; Loading @@ -30,7 +27,6 @@ import es.upv.mist.slicing.utils.StaticTypeSolver; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.util.*; import static es.upv.mist.slicing.util.SingletonCollector.toSingleton; Loading @@ -39,18 +35,11 @@ public class I_ACFG extends Graph { protected static final Map<CallableDeclaration<?>, CFG> acfgMap = ASTUtils.newIdentityHashMap(); protected CallGraph callGraph; protected boolean built = false; public static void main(String[] args) throws IOException { String ruta = "/src/main/java/es/upv/mist/slicing/tests/"; String fichero = "Test.java"; I_ACFG iAcfg = new I_ACFG(); iAcfg.generarACFG(ruta, fichero); } public void generarACFG(String ruta, String fichero) throws IOException { public void build(File file) { if (built) return; NodeList<CompilationUnit> units = new NodeList<>(); File file = new File(CodeGenerationUtils.mavenModuleRoot(I_ACFG.class)+ruta+fichero); StaticJavaParser.getConfiguration().setAttributeComments(false); StaticTypeSolver.addTypeSolverJRE(); Loading @@ -68,16 +57,7 @@ public class I_ACFG extends Graph { copyACFGs(); expandCalls(); joinACFGs(); new GraphLog<>(this) { @Override protected DOTAttributes edgeAttributes(Arc arc) { DOTAttributes att = super.edgeAttributes(arc); if (arc.isNonExecutableControlFlowArc()) att.add("style", "dashed"); return att; } }.generateImages("migrafo"); System.out.println("Grafo generado..."); built = true; } protected void buildACFGs(NodeList<CompilationUnit> nodeList) { Loading
iacfg/src/test/java/es/upv/mist/slicing/graphs/icfg/IACFGTest.java 0 → 100644 +28 −0 Original line number Diff line number Diff line package es.upv.mist.slicing.graphs.icfg; import es.upv.mist.slicing.I_ACFG; import es.upv.mist.slicing.arcs.Arc; import es.upv.mist.slicing.cli.DOTAttributes; import es.upv.mist.slicing.cli.GraphLog; import java.io.File; import java.io.IOException; public class IACFGTest { public static void main(String[] args) throws IOException { File file = new File(Thread.currentThread().getContextClassLoader().getResource("Test.java").getPath()); I_ACFG icfg = new I_ACFG(); icfg.build(file); new GraphLog<>(icfg) { @Override protected DOTAttributes edgeAttributes(Arc arc) { DOTAttributes att = super.edgeAttributes(arc); if (arc.isNonExecutableControlFlowArc()) att.add("style", "dashed"); return att; } }.generateImages("migrafo"); System.out.println("Grafo generado..."); } }
iacfg/src/main/java/es/upv/mist/slicing/tests/Test.java→iacfg/src/test/resources/Test.java +0 −2 Original line number Diff line number Diff line package es.upv.mist.slicing.tests; public class Test { public static int z = 0; Loading