From c7a2eb709a320781cf304970e94c9caab848c930 Mon Sep 17 00:00:00 2001 From: Carlos Galindo Date: Sat, 27 Feb 2021 13:25:14 +0100 Subject: [PATCH 1/3] moved unnecessary fields from JSysCFG to JSysCFG.Builder Closes #54 --- .../mist/slicing/graphs/jsysdg/JSysCFG.java | 36 +++++++++---------- .../mist/slicing/graphs/jsysdg/JSysDG.java | 8 ++++- .../mist/slicing/graphs/jsysdg/JSysPDG.java | 8 ++--- .../es/upv/mist/slicing/graphs/sdg/SDG.java | 9 +++-- 4 files changed, 34 insertions(+), 27 deletions(-) diff --git a/sdg-core/src/main/java/es/upv/mist/slicing/graphs/jsysdg/JSysCFG.java b/sdg-core/src/main/java/es/upv/mist/slicing/graphs/jsysdg/JSysCFG.java index f43e32a..736ee74 100644 --- a/sdg-core/src/main/java/es/upv/mist/slicing/graphs/jsysdg/JSysCFG.java +++ b/sdg-core/src/main/java/es/upv/mist/slicing/graphs/jsysdg/JSysCFG.java @@ -25,22 +25,20 @@ import java.util.Set; * polymorphism and other features. */ public class JSysCFG extends ESCFG { - /** ClassGraph associated to the Method represented by the CFG */ - protected ClassGraph classGraph; - /** Set of constructors that must be built with implicit nodes. */ - protected Set implicitConstructors; - - public JSysCFG(ClassGraph classGraph, Set implicitConstructors) { - super(); - this.classGraph = classGraph; - this.implicitConstructors = implicitConstructors; + @Override + public void build(CallableDeclaration declaration) { + throw new UnsupportedOperationException("Use build(CallableDeclaration, ClassGraph, Set)"); } - @Override - public void buildRootNode(CallableDeclaration rootNodeAst) { - super.buildRootNode(rootNodeAst); - if (implicitConstructors.contains(rootNodeAst)) - rootNode.markAsImplicit(); + public void build(CallableDeclaration declaration, ClassGraph classGraph, Set implicitConstructors) { + Builder builder = (Builder) newCFGBuilder(); + builder.classGraph = classGraph; + builder.implicitDeclaration = implicitConstructors.contains(declaration); + declaration.accept(builder, null); + // Verify that it has been built + exitNode = vertexSet().stream().filter(MethodExitNode.class::isInstance).findFirst() + .orElseThrow(() -> new IllegalStateException("Built graph has no exit node!")); + built = true; } @Override @@ -49,6 +47,8 @@ public class JSysCFG extends ESCFG { } public class Builder extends ESCFG.Builder { + /** ClassGraph associated to the Method represented by the CFG */ + protected ClassGraph classGraph; /** List of implicit instructions inserted explicitly in this CFG. * They should be included in the graph as ImplicitNodes. */ protected List methodInsertedInstructions = new LinkedList<>(); @@ -93,8 +93,6 @@ public class JSysCFG extends ESCFG { @Override public void visit(ConstructorDeclaration n, Void arg) { - if (implicitConstructors.contains(n)) - implicitDeclaration = true; // Insert call to super() if it is implicit. if (!ASTUtils.constructorHasExplicitConstructorInvocation(n)){ var superCall = new ExplicitConstructorInvocationStmt(null, null, false, null, new NodeList<>()); @@ -106,11 +104,13 @@ public class JSysCFG extends ESCFG { } // Perform the same task as previous graphs. super.visit(n, arg); - // Convert the exit nodes to implicit if appropriate - if (implicitDeclaration) + // Convert enter/exit nodes to implicit if appropriate + if (implicitDeclaration) { + getRootNode().markAsImplicit(); vertexSet().stream() .filter(MethodExitNode.class::isInstance) .forEach(GraphNode::markAsImplicit); + } } } } diff --git a/sdg-core/src/main/java/es/upv/mist/slicing/graphs/jsysdg/JSysDG.java b/sdg-core/src/main/java/es/upv/mist/slicing/graphs/jsysdg/JSysDG.java index eaf5a36..c8a6f62 100644 --- a/sdg-core/src/main/java/es/upv/mist/slicing/graphs/jsysdg/JSysDG.java +++ b/sdg-core/src/main/java/es/upv/mist/slicing/graphs/jsysdg/JSysDG.java @@ -3,6 +3,7 @@ package es.upv.mist.slicing.graphs.jsysdg; import com.github.javaparser.ast.CompilationUnit; import com.github.javaparser.ast.Modifier; import com.github.javaparser.ast.NodeList; +import com.github.javaparser.ast.body.CallableDeclaration; import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; import com.github.javaparser.ast.body.ConstructorDeclaration; import com.github.javaparser.ast.visitor.ModifierVisitor; @@ -45,9 +46,14 @@ public class JSysDG extends ESSDG { }, null); } + @Override + protected void buildCFG(CallableDeclaration declaration, CFG cfg) { + ((JSysCFG) cfg).build(declaration, classGraph, newlyInsertedConstructors); + } + @Override protected CFG createCFG() { - return new JSysCFG(classGraph, newlyInsertedConstructors); + return new JSysCFG(); } @Override diff --git a/sdg-core/src/main/java/es/upv/mist/slicing/graphs/jsysdg/JSysPDG.java b/sdg-core/src/main/java/es/upv/mist/slicing/graphs/jsysdg/JSysPDG.java index abd225e..487ed1d 100644 --- a/sdg-core/src/main/java/es/upv/mist/slicing/graphs/jsysdg/JSysPDG.java +++ b/sdg-core/src/main/java/es/upv/mist/slicing/graphs/jsysdg/JSysPDG.java @@ -1,14 +1,10 @@ package es.upv.mist.slicing.graphs.jsysdg; -import com.github.javaparser.ast.body.ConstructorDeclaration; -import es.upv.mist.slicing.graphs.ClassGraph; import es.upv.mist.slicing.graphs.exceptionsensitive.ESPDG; -import java.util.Set; - public class JSysPDG extends ESPDG { - public JSysPDG(ClassGraph classGraph, Set implicitConstructors) { - this(new JSysCFG(classGraph, implicitConstructors)); + public JSysPDG() { + this(new JSysCFG()); } public JSysPDG(JSysCFG cfg) { diff --git a/sdg-core/src/main/java/es/upv/mist/slicing/graphs/sdg/SDG.java b/sdg-core/src/main/java/es/upv/mist/slicing/graphs/sdg/SDG.java index 4e6209b..ad185c5 100644 --- a/sdg-core/src/main/java/es/upv/mist/slicing/graphs/sdg/SDG.java +++ b/sdg-core/src/main/java/es/upv/mist/slicing/graphs/sdg/SDG.java @@ -129,19 +129,24 @@ public class SDG extends Graph implements Sliceable, Buildable declaration, CFG cfg) { + cfg.build(declaration); + } + /** Create call graph from the list of compilation units. */ protected CallGraph createCallGraph(NodeList nodeList) { CallGraph callGraph = new CallGraph(cfgMap, classGraph); -- GitLab From 2597482f7e6ad08d09115a4362a8b45f4ef5652b Mon Sep 17 00:00:00 2001 From: Carlos Galindo Date: Sun, 28 Feb 2021 16:25:41 +0100 Subject: [PATCH 2/3] ClassGraph: unify keys and usage of vertexDeclarationMap * Closes #52 * Simplify calls and remove unnecessary searches. * Make dotexporter functional --- .../es/upv/mist/slicing/graphs/CallGraph.java | 2 +- .../upv/mist/slicing/graphs/ClassGraph.java | 143 +++++++----------- .../mist/slicing/graphs/jsysdg/JSysCFG.java | 14 +- .../mist/slicing/graphs/jsysdg/JSysDG.java | 2 +- .../es/upv/mist/slicing/utils/ASTUtils.java | 14 ++ 5 files changed, 74 insertions(+), 101 deletions(-) diff --git a/sdg-core/src/main/java/es/upv/mist/slicing/graphs/CallGraph.java b/sdg-core/src/main/java/es/upv/mist/slicing/graphs/CallGraph.java index f0cdb2c..3d1a880 100644 --- a/sdg-core/src/main/java/es/upv/mist/slicing/graphs/CallGraph.java +++ b/sdg-core/src/main/java/es/upv/mist/slicing/graphs/CallGraph.java @@ -217,7 +217,7 @@ public class CallGraph extends DirectedPseudograph classGraph.findMethodByTypeAndSignature(t, decl.getSignature())) + .map(t -> classGraph.findMethodByTypeAndSignature(t, decl)) .collect(Collectors.toCollection(NodeHashSet::new)) .forEach(methodDecl -> { edgesCreated.getAndIncrement(); diff --git a/sdg-core/src/main/java/es/upv/mist/slicing/graphs/ClassGraph.java b/sdg-core/src/main/java/es/upv/mist/slicing/graphs/ClassGraph.java index 5dc4c88..bc5bcc9 100644 --- a/sdg-core/src/main/java/es/upv/mist/slicing/graphs/ClassGraph.java +++ b/sdg-core/src/main/java/es/upv/mist/slicing/graphs/ClassGraph.java @@ -1,7 +1,6 @@ package es.upv.mist.slicing.graphs; import com.github.javaparser.ast.CompilationUnit; -import com.github.javaparser.ast.Modifier; import com.github.javaparser.ast.NodeList; import com.github.javaparser.ast.body.*; import com.github.javaparser.ast.visitor.VoidVisitorAdapter; @@ -33,33 +32,11 @@ public class ClassGraph extends DirectedPseudograph v.declaration.isClassOrInterfaceDeclaration()) - .filter(v -> ASTUtils.equalsWithRangeInCU(v.declaration, declaration)) - .findFirst().orElseThrow(); - } - - /** Locates the vertex that represents a given class or interface declaration. - * The vertex must exist, or an exception will be thrown. */ - protected Vertex findClassVertex(ResolvedClassDeclaration declaration) { - return vertexSet().stream() - .filter(v -> v.declaration.isClassOrInterfaceDeclaration()) - .filter(v -> v.declaration.asClassOrInterfaceDeclaration().resolve().asClass().equals(declaration)) - .findFirst().orElseThrow(); - } - - protected Vertex findClassVertex(ResolvedReferenceType type) { - return vertexSet().stream() - .filter(v -> v.declaration.isClassOrInterfaceDeclaration()) - .filter(v -> ASTUtils.resolvedTypeDeclarationToResolvedType(v.declaration.asClassOrInterfaceDeclaration().resolve()).equals(type)) - .findFirst().orElseThrow(); + return vertexDeclarationMap.get(mapKey(declaration)); } protected Vertex findMethodVertex(CallableDeclaration declaration) { - return vertexSet().stream() - .filter(v -> v.declaration.isCallableDeclaration()) - .filter(v -> ASTUtils.equalsWithRangeInCU(v.declaration, declaration)) - .findFirst().orElseThrow(); + return vertexDeclarationMap.get(mapKey(declaration, ASTUtils.getClassNode(declaration))); } public Set overriddenSetOf(MethodDeclaration method) { @@ -90,11 +67,11 @@ public class ClassGraph extends DirectedPseudograph subclassesOf(ResolvedClassDeclaration clazz) { - return subclassesOf(findClassVertex(clazz)); + return subclassesOf(vertexDeclarationMap.get(mapKey(clazz))); } public Set subclassesOf(ResolvedReferenceType type) { - return subclassesOf(findClassVertex(type)); + return subclassesOf(vertexDeclarationMap.get(mapKey(type))); } /** @see #subclassesOf(ClassOrInterfaceDeclaration) */ @@ -115,21 +92,14 @@ public class ClassGraph extends DirectedPseudograph result = outgoingEdgesOf(findClassVertex(type)).stream() - .filter(ClassArc.Member.class::isInstance) - .map(this::getEdgeTarget) - .map(Vertex::getDeclaration) - .filter(BodyDeclaration::isMethodDeclaration) - .map(BodyDeclaration::asMethodDeclaration) - .filter(decl -> signature.equals(decl.getSignature())) - .findFirst(); - if (result.isPresent()) - return result.get(); + public MethodDeclaration findMethodByTypeAndSignature(ClassOrInterfaceDeclaration type, CallableDeclaration declaration) { + Vertex v = vertexDeclarationMap.get(mapKey(declaration, type)); + if (v != null && v.declaration.isMethodDeclaration()) + return v.declaration.asMethodDeclaration(); Optional parentType = parentOf(type); if (parentType.isEmpty()) - throw new IllegalArgumentException("Cannot find the given signature: " + signature); - return findMethodByTypeAndSignature(parentType.get(), signature); + throw new IllegalArgumentException("Cannot find the given declaration: " + declaration); + return findMethodByTypeAndSignature(parentType.get(), declaration); } /** Find the parent class or interface of a given class. */ @@ -157,6 +127,26 @@ public class ClassGraph extends DirectedPseudograph declaration, ClassOrInterfaceDeclaration clazz) { + return clazz.getFullyQualifiedName().orElseThrow() + "." + declaration.getSignature(); + } + + protected String mapKey(FieldDeclaration declaration, ClassOrInterfaceDeclaration clazz) { + return clazz.getFullyQualifiedName().orElseThrow() + "." + declaration; + } + /** Find the class declarations, the field declaration, and method and constructor declarations (vertices) * in the given list of compilation units. */ protected void buildVertices(NodeList arg) { @@ -177,16 +167,19 @@ public class ClassGraph extends DirectedPseudograph n, ClassOrInterfaceDeclaration c){ assert n instanceof ConstructorDeclaration || n instanceof MethodDeclaration; ClassGraph.Vertex v = new ClassGraph.Vertex(n); - vertexDeclarationMap.put(c.getFullyQualifiedName().get()+ "." + n.getSignature().toString(), v); + vertexDeclarationMap.put(mapKey(n, c), v); addVertex(v); } @@ -224,7 +217,7 @@ public class ClassGraph extends DirectedPseudograph { - Vertex source = vertexDeclarationMap.get(p.getNameAsString()); + Vertex source = vertexDeclarationMap.get(mapKey(p.resolve())); if (source != null && containsVertex(v)) addEdge(source, v, new ClassArc.Extends()); }); dv.getImplementedTypes().forEach(p -> { - Vertex source = vertexDeclarationMap.get(p.getNameAsString()); + Vertex source = vertexDeclarationMap.get(mapKey(p.resolve())); if (source != null && containsVertex(v)) addEdge(source, v, new ClassArc.Implements()); }); } + /** Creates a graph-appropriate DOT exporter. */ - public DOTExporter, CallGraph.Edge> getDOTExporter() { - DOTExporter, CallGraph.Edge> dot = new DOTExporter<>(); - dot.setVertexAttributeProvider(decl -> Utils.dotLabel(decl.getDeclarationAsString(false, false, false))); - dot.setEdgeAttributeProvider(edge -> Utils.dotLabel(edge.getCall().toString())); + public DOTExporter getDOTExporter() { + DOTExporter dot = new DOTExporter<>(); + dot.setVertexAttributeProvider(vertex -> Utils.dotLabel(vertex.declaration.toString().replaceAll("\\{.*}", ""))); + dot.setEdgeAttributeProvider(edge -> Utils.dotLabel(edge.getClass().getSimpleName())); return dot; } @@ -306,40 +303,8 @@ public class ClassGraph extends DirectedPseudograph> getStaticInit(String className){ - return getClassInit(className,true); - } - - /** Returns a List with the dynamic FieldDeclarations and InitializerDeclarations of the given class */ - public List> getDynInit(String className){ - return getClassInit(className,false); - } - - /** Returns a List with FieldDeclarations and InitializerDeclarations static/dynamic items of the given class */ - private List> getClassInit(String className, Boolean isStatic){ - Vertex classNode = vertexDeclarationMap.get(className); - List> members = classNode.declaration.asClassOrInterfaceDeclaration().getMembers(); - List> classInit = new LinkedList<>(); - for (BodyDeclaration member : members) { - if (member instanceof CallableDeclaration) - continue; - - if (member.isFieldDeclaration()) { - if (isStatic == member.asFieldDeclaration().hasModifier(Modifier.Keyword.STATIC)) - classInit.add(member); - continue; - } - - if (member.isInitializerDeclaration()) - if (isStatic == member.asInitializerDeclaration().isStatic()) - classInit.add(member); + return declaration.toString(); } - return classInit; } protected static class ClassArc extends Arc { diff --git a/sdg-core/src/main/java/es/upv/mist/slicing/graphs/jsysdg/JSysCFG.java b/sdg-core/src/main/java/es/upv/mist/slicing/graphs/jsysdg/JSysCFG.java index 736ee74..b184a5f 100644 --- a/sdg-core/src/main/java/es/upv/mist/slicing/graphs/jsysdg/JSysCFG.java +++ b/sdg-core/src/main/java/es/upv/mist/slicing/graphs/jsysdg/JSysCFG.java @@ -3,13 +3,11 @@ package es.upv.mist.slicing.graphs.jsysdg; import com.github.javaparser.ast.Node; import com.github.javaparser.ast.NodeList; import com.github.javaparser.ast.body.CallableDeclaration; -import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; import com.github.javaparser.ast.body.ConstructorDeclaration; import com.github.javaparser.ast.body.FieldDeclaration; import com.github.javaparser.ast.expr.ThisExpr; import com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt; import com.github.javaparser.ast.stmt.ReturnStmt; -import es.upv.mist.slicing.graphs.ClassGraph; import es.upv.mist.slicing.graphs.cfg.CFGBuilder; import es.upv.mist.slicing.graphs.exceptionsensitive.ESCFG; import es.upv.mist.slicing.nodes.GraphNode; @@ -30,9 +28,8 @@ public class JSysCFG extends ESCFG { throw new UnsupportedOperationException("Use build(CallableDeclaration, ClassGraph, Set)"); } - public void build(CallableDeclaration declaration, ClassGraph classGraph, Set implicitConstructors) { + public void build(CallableDeclaration declaration, Set implicitConstructors) { Builder builder = (Builder) newCFGBuilder(); - builder.classGraph = classGraph; builder.implicitDeclaration = implicitConstructors.contains(declaration); declaration.accept(builder, null); // Verify that it has been built @@ -47,8 +44,6 @@ public class JSysCFG extends ESCFG { } public class Builder extends ESCFG.Builder { - /** ClassGraph associated to the Method represented by the CFG */ - protected ClassGraph classGraph; /** List of implicit instructions inserted explicitly in this CFG. * They should be included in the graph as ImplicitNodes. */ protected List methodInsertedInstructions = new LinkedList<>(); @@ -77,10 +72,9 @@ public class JSysCFG extends ESCFG { // 1. Connect to the following statements connectTo(n); // 2. Insert dynamic class code (only for super()) - if (!n.isThis()) { - ClassOrInterfaceDeclaration containerClass = ASTUtils.getClassNode(rootNode.getAstNode()); - classGraph.getDynInit(containerClass.getNameAsString()).forEach(node -> node.accept(this, arg)); - } + if (!n.isThis()) + ASTUtils.getClassInit(ASTUtils.getClassNode(rootNode.getAstNode()), false) + .forEach(node -> node.accept(this, arg)); // 3. Handle exceptions super.visitCallForExceptions(n); } diff --git a/sdg-core/src/main/java/es/upv/mist/slicing/graphs/jsysdg/JSysDG.java b/sdg-core/src/main/java/es/upv/mist/slicing/graphs/jsysdg/JSysDG.java index c8a6f62..809c0d6 100644 --- a/sdg-core/src/main/java/es/upv/mist/slicing/graphs/jsysdg/JSysDG.java +++ b/sdg-core/src/main/java/es/upv/mist/slicing/graphs/jsysdg/JSysDG.java @@ -48,7 +48,7 @@ public class JSysDG extends ESSDG { @Override protected void buildCFG(CallableDeclaration declaration, CFG cfg) { - ((JSysCFG) cfg).build(declaration, classGraph, newlyInsertedConstructors); + ((JSysCFG) cfg).build(declaration, newlyInsertedConstructors); } @Override diff --git a/sdg-core/src/main/java/es/upv/mist/slicing/utils/ASTUtils.java b/sdg-core/src/main/java/es/upv/mist/slicing/utils/ASTUtils.java index 0d8629c..88b1717 100644 --- a/sdg-core/src/main/java/es/upv/mist/slicing/utils/ASTUtils.java +++ b/sdg-core/src/main/java/es/upv/mist/slicing/utils/ASTUtils.java @@ -200,4 +200,18 @@ public class ASTUtils { } throw new IllegalArgumentException("Invalid typing for a field"); } + + /** Returns a List with FieldDeclarations and InitializerDeclarations static/dynamic items of the given class */ + public static List> getClassInit(ClassOrInterfaceDeclaration clazz, boolean isStatic) { + List> classInit = new LinkedList<>(); + for (BodyDeclaration member : clazz.getMembers()) { + if (member.isFieldDeclaration() && + member.asFieldDeclaration().isStatic() == isStatic) + classInit.add(member); + if (member.isInitializerDeclaration() && + member.asInitializerDeclaration().isStatic() == isStatic) + classInit.add(member); + } + return classInit; + } } -- GitLab From 5f2ef1f1c8bac96db57fcbdb009783dddc13b3f8 Mon Sep 17 00:00:00 2001 From: Carlos Galindo Date: Sun, 28 Feb 2021 18:05:15 +0100 Subject: [PATCH 3/3] GraphNode#addActionsForCall now uses List instead of Set Closes #53 --- .../graphs/sdg/InterproceduralDefinitionFinder.java | 6 ++---- .../slicing/graphs/sdg/InterproceduralUsageFinder.java | 6 +++--- .../src/main/java/es/upv/mist/slicing/graphs/sdg/SDG.java | 4 ++-- .../src/main/java/es/upv/mist/slicing/nodes/GraphNode.java | 7 +++++-- .../java/es/upv/mist/slicing/nodes/VariableVisitor.java | 4 ++-- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/sdg-core/src/main/java/es/upv/mist/slicing/graphs/sdg/InterproceduralDefinitionFinder.java b/sdg-core/src/main/java/es/upv/mist/slicing/graphs/sdg/InterproceduralDefinitionFinder.java index 7ad47b3..b9ca771 100644 --- a/sdg-core/src/main/java/es/upv/mist/slicing/graphs/sdg/InterproceduralDefinitionFinder.java +++ b/sdg-core/src/main/java/es/upv/mist/slicing/graphs/sdg/InterproceduralDefinitionFinder.java @@ -12,9 +12,7 @@ import es.upv.mist.slicing.nodes.VariableAction; import es.upv.mist.slicing.nodes.io.ActualIONode; import es.upv.mist.slicing.nodes.io.FormalIONode; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; +import java.util.*; import java.util.stream.Stream; /** An interprocedural definition finder, which adds the associated actions to formal and actual nodes in the CFGs. */ @@ -37,7 +35,7 @@ public class InterproceduralDefinitionFinder extends InterproceduralActionFinder @Override protected void handleActualAction(CallGraph.Edge edge, VariableAction.Definition def) { - Set movables = new HashSet<>(); + List movables = new LinkedList<>(); GraphNode graphNode = edge.getGraphNode(); ResolvedValueDeclaration resolved = def.getResolvedValueDeclaration(); if (resolved.isParameter()) { diff --git a/sdg-core/src/main/java/es/upv/mist/slicing/graphs/sdg/InterproceduralUsageFinder.java b/sdg-core/src/main/java/es/upv/mist/slicing/graphs/sdg/InterproceduralUsageFinder.java index 20919e9..979200f 100644 --- a/sdg-core/src/main/java/es/upv/mist/slicing/graphs/sdg/InterproceduralUsageFinder.java +++ b/sdg-core/src/main/java/es/upv/mist/slicing/graphs/sdg/InterproceduralUsageFinder.java @@ -12,9 +12,9 @@ import es.upv.mist.slicing.nodes.VariableVisitor; import es.upv.mist.slicing.nodes.io.ActualIONode; import es.upv.mist.slicing.nodes.io.FormalIONode; -import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; import java.util.Map; -import java.util.Set; import java.util.function.Predicate; import java.util.stream.Stream; @@ -34,7 +34,7 @@ public class InterproceduralUsageFinder extends InterproceduralActionFinder edge, VariableAction.Usage use) { - Set movables = new HashSet<>(); + List movables = new LinkedList<>(); GraphNode graphNode = edge.getGraphNode(); ResolvedValueDeclaration resolved = use.getResolvedValueDeclaration(); if (resolved.isParameter()) { diff --git a/sdg-core/src/main/java/es/upv/mist/slicing/graphs/sdg/SDG.java b/sdg-core/src/main/java/es/upv/mist/slicing/graphs/sdg/SDG.java index ad185c5..a5767b2 100644 --- a/sdg-core/src/main/java/es/upv/mist/slicing/graphs/sdg/SDG.java +++ b/sdg-core/src/main/java/es/upv/mist/slicing/graphs/sdg/SDG.java @@ -28,9 +28,9 @@ import es.upv.mist.slicing.slicing.*; import es.upv.mist.slicing.utils.ASTUtils; import java.util.Collection; +import java.util.List; import java.util.Map; import java.util.Optional; -import java.util.Set; import static es.upv.mist.slicing.graphs.cfg.CFGBuilder.VARIABLE_NAME_OUTPUT; @@ -181,7 +181,7 @@ public class SDG extends Graph implements Sliceable, Buildable implements Comparable> { } /** Append or prepend the given set of actions to the actions of the given call. */ - public void addActionsForCall(Set actions, Resolvable call, boolean prepend) { + public void addActionsForCall(List actions, Resolvable call, boolean prepend) { for (int i = 0; i < variableActions.size(); i++) { VariableAction var = variableActions.get(i); if (var instanceof VariableAction.CallMarker) { diff --git a/sdg-core/src/main/java/es/upv/mist/slicing/nodes/VariableVisitor.java b/sdg-core/src/main/java/es/upv/mist/slicing/nodes/VariableVisitor.java index fff9573..276207c 100644 --- a/sdg-core/src/main/java/es/upv/mist/slicing/nodes/VariableVisitor.java +++ b/sdg-core/src/main/java/es/upv/mist/slicing/nodes/VariableVisitor.java @@ -20,8 +20,8 @@ import es.upv.mist.slicing.utils.Logger; import java.util.Deque; import java.util.LinkedList; +import java.util.List; import java.util.Objects; -import java.util.Set; import static es.upv.mist.slicing.graphs.cfg.CFGBuilder.VARIABLE_NAME_OUTPUT; @@ -272,7 +272,7 @@ public class VariableVisitor extends GraphNodeContentVisitor