Skip to content

Commit

Permalink
Change DoubleSourceConflict to ConfluenceConflictReport plus minor ch…
Browse files Browse the repository at this point in the history
…anges
  • Loading branch information
LSinzker committed Apr 27, 2020
1 parent 5135d53 commit 77714f5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import br.unb.cic.analysis.AbstractMergeConflictDefinition;
import br.unb.cic.analysis.model.Conflict;
import br.unb.cic.analysis.model.DoubleSourceConflict;
import br.unb.cic.analysis.model.ConfluenceConflictReport;
import br.unb.cic.analysis.model.Statement;
import soot.Body;
import soot.Local;
Expand Down Expand Up @@ -30,10 +30,13 @@ protected FlowSet<DataFlowAbstraction> gen(Unit u, FlowSet<DataFlowAbstraction>
}
}
else if (u.getDefBoxes().size() > 0) {
u.getUseBoxes().forEach(v -> {
u.getUseBoxes().stream().filter(v -> v.getValue() instanceof Local).forEach(v -> {
Local local = (Local) v.getValue();
in.forEach(sourceDefs -> {
if(sourceDefs.getLocal() == v.getValue()){ //if variable in the analyzed stmt is present in IN
u.getDefBoxes().forEach(def -> {
if(sourceDefs.getLocal().equals(local)){ //if variable in the analyzed stmt is present in IN
u.getDefBoxes().stream()
.filter(def -> def.getValue() instanceof Local)
.forEach(def -> {
res.add(new DataFlowAbstraction((Local)def.getValue(), findStatement(u))); //add variable assigned as the stmt to IN
});
}
Expand Down Expand Up @@ -64,7 +67,7 @@ protected void detectConflict(FlowSet<DataFlowAbstraction> in, Unit u){

for(Statement source: sources){
for(Statement sink: sinks){
Conflict c = new DoubleSourceConflict(source, sink, findStatement(u));
Conflict c = new ConfluenceConflictReport(source, sink, findStatement(u));
Collector.instance().addConflict(c);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import br.unb.cic.analysis.AbstractMergeConflictDefinition;
import br.unb.cic.analysis.model.Conflict;
import br.unb.cic.analysis.model.DoubleSourceConflict;
import br.unb.cic.analysis.model.ConfluenceConflictReport;
import br.unb.cic.analysis.model.Statement;
import soot.Body;
import soot.Local;
Expand Down Expand Up @@ -56,7 +56,7 @@ protected void detectConflict(FlowSet<DataFlowAbstraction> in, Unit u) {
//report the conflicts
for(Statement source: sources) {
for(Statement sink: sinks) {
Conflict c = new DoubleSourceConflict(source, sink, findStatement(u));
Conflict c = new ConfluenceConflictReport(source, sink, findStatement(u));
Collector.instance().addConflict(c);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

import java.util.Objects;

public class DoubleSourceConflict extends Conflict {
public class ConfluenceConflictReport extends Conflict {

protected String targetClassName;
protected String targetMethodName;
protected Integer targetLineNumber;

public DoubleSourceConflict(Statement source, Statement sink, Statement target) {
public ConfluenceConflictReport(Statement source, Statement sink, Statement target) {
super(source, sink);
targetClassName = target.getSootClass().getName();
targetMethodName = target.getSootMethod().getName();
Expand All @@ -20,7 +20,7 @@ public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
DoubleSourceConflict that = (DoubleSourceConflict) o;
ConfluenceConflictReport that = (ConfluenceConflictReport) o;
return Objects.equals(targetClassName, that.targetClassName) &&
Objects.equals(targetMethodName, that.targetMethodName) &&
Objects.equals(targetLineNumber, that.targetLineNumber);
Expand Down

0 comments on commit 77714f5

Please sign in to comment.