Loading sdg-core/src/main/java/es/upv/mist/slicing/graphs/ClassGraph.java +3 −7 Original line number Diff line number Diff line Loading @@ -10,7 +10,6 @@ import com.github.javaparser.resolution.types.ResolvedReferenceType; import es.upv.mist.slicing.arcs.Arc; import es.upv.mist.slicing.nodes.VariableAction.ObjectTree; import es.upv.mist.slicing.utils.ASTUtils; import es.upv.mist.slicing.utils.Logger; import es.upv.mist.slicing.utils.Utils; import org.jgrapht.graph.DirectedPseudograph; import org.jgrapht.nio.dot.DOTExporter; Loading Loading @@ -151,15 +150,12 @@ public class ClassGraph extends DirectedPseudograph<ClassGraph.Vertex, ClassGrap } public ObjectTree generateObjectTreeFor(ResolvedReferenceType type) { Vertex classVertex = vertexDeclarationMap.get(mapKey(type)); if (classVertex == null) { Logger.log("ResolvedReferenceType could not be found in class graph: " + type.describe()); return new ObjectTree(); } return generateObjectTreeFor(classVertex); return generateObjectTreeFor(vertexDeclarationMap.get(mapKey(type))); } protected ObjectTree generateObjectTreeFor(Vertex classVertex) { if (classVertex == null) return new ObjectTree(); return generateObjectTreeFor(classVertex, new ObjectTree(), "-root-"); } Loading sdg-core/src/main/java/es/upv/mist/slicing/graphs/exceptionsensitive/ESCFG.java +0 −1 Original line number Diff line number Diff line Loading @@ -240,7 +240,6 @@ public class ESCFG extends ACFG { stmtStack.push(n); GraphNode<ThrowStmt> stmt = connectTo(n); n.getExpression().accept(this, arg); stmt.addVADefineActiveException(n.getExpression()); populateExceptionSourceMap(new ExceptionSource(stmt, n.getExpression().calculateResolvedType())); clearHanging(); nonExecHangingNodes.add(stmt); Loading sdg-core/src/main/java/es/upv/mist/slicing/nodes/VariableVisitor.java +12 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import java.util.List; import java.util.Optional; import static es.upv.mist.slicing.graphs.cfg.CFGBuilder.VARIABLE_NAME_OUTPUT; import static es.upv.mist.slicing.graphs.exceptionsensitive.ESCFG.ACTIVE_EXCEPTION_VARIABLE; import static es.upv.mist.slicing.nodes.VariableVisitor.Action.*; /** A graph node visitor that extracts the actions performed in a given GraphNode. An initial action mode can Loading Loading @@ -170,6 +171,17 @@ public class VariableVisitor extends GraphNodeContentVisitor<VariableVisitor.Act } } @Override public void visit(ThrowStmt n, Action arg) { super.visit(n, arg); definitionStack.push(n.getExpression()); acceptAction(ACTIVE_EXCEPTION_VARIABLE, DEFINITION); definitionStack.pop(); var fields = ClassGraph.getInstance().generateObjectTreeFor(n.getExpression().calculateResolvedType().asReferenceType()); graphNode.getVariableActions().get(graphNode.getVariableActions().size() - 1).getObjectTree().addAll(fields); new ExpressionObjectTreeFinder(graphNode).locateAndMarkTransferenceToRoot(n.getExpression(), -1); } @Override public void visit(ForEachStmt n, Action action) { n.getIterable().accept(this, USE); Loading Loading
sdg-core/src/main/java/es/upv/mist/slicing/graphs/ClassGraph.java +3 −7 Original line number Diff line number Diff line Loading @@ -10,7 +10,6 @@ import com.github.javaparser.resolution.types.ResolvedReferenceType; import es.upv.mist.slicing.arcs.Arc; import es.upv.mist.slicing.nodes.VariableAction.ObjectTree; import es.upv.mist.slicing.utils.ASTUtils; import es.upv.mist.slicing.utils.Logger; import es.upv.mist.slicing.utils.Utils; import org.jgrapht.graph.DirectedPseudograph; import org.jgrapht.nio.dot.DOTExporter; Loading Loading @@ -151,15 +150,12 @@ public class ClassGraph extends DirectedPseudograph<ClassGraph.Vertex, ClassGrap } public ObjectTree generateObjectTreeFor(ResolvedReferenceType type) { Vertex classVertex = vertexDeclarationMap.get(mapKey(type)); if (classVertex == null) { Logger.log("ResolvedReferenceType could not be found in class graph: " + type.describe()); return new ObjectTree(); } return generateObjectTreeFor(classVertex); return generateObjectTreeFor(vertexDeclarationMap.get(mapKey(type))); } protected ObjectTree generateObjectTreeFor(Vertex classVertex) { if (classVertex == null) return new ObjectTree(); return generateObjectTreeFor(classVertex, new ObjectTree(), "-root-"); } Loading
sdg-core/src/main/java/es/upv/mist/slicing/graphs/exceptionsensitive/ESCFG.java +0 −1 Original line number Diff line number Diff line Loading @@ -240,7 +240,6 @@ public class ESCFG extends ACFG { stmtStack.push(n); GraphNode<ThrowStmt> stmt = connectTo(n); n.getExpression().accept(this, arg); stmt.addVADefineActiveException(n.getExpression()); populateExceptionSourceMap(new ExceptionSource(stmt, n.getExpression().calculateResolvedType())); clearHanging(); nonExecHangingNodes.add(stmt); Loading
sdg-core/src/main/java/es/upv/mist/slicing/nodes/VariableVisitor.java +12 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import java.util.List; import java.util.Optional; import static es.upv.mist.slicing.graphs.cfg.CFGBuilder.VARIABLE_NAME_OUTPUT; import static es.upv.mist.slicing.graphs.exceptionsensitive.ESCFG.ACTIVE_EXCEPTION_VARIABLE; import static es.upv.mist.slicing.nodes.VariableVisitor.Action.*; /** A graph node visitor that extracts the actions performed in a given GraphNode. An initial action mode can Loading Loading @@ -170,6 +171,17 @@ public class VariableVisitor extends GraphNodeContentVisitor<VariableVisitor.Act } } @Override public void visit(ThrowStmt n, Action arg) { super.visit(n, arg); definitionStack.push(n.getExpression()); acceptAction(ACTIVE_EXCEPTION_VARIABLE, DEFINITION); definitionStack.pop(); var fields = ClassGraph.getInstance().generateObjectTreeFor(n.getExpression().calculateResolvedType().asReferenceType()); graphNode.getVariableActions().get(graphNode.getVariableActions().size() - 1).getObjectTree().addAll(fields); new ExpressionObjectTreeFinder(graphNode).locateAndMarkTransferenceToRoot(n.getExpression(), -1); } @Override public void visit(ForEachStmt n, Action action) { n.getIterable().accept(this, USE); Loading