Skip to content

Commit

Permalink
feat(spgroup#31): adjusts
Browse files Browse the repository at this point in the history
  • Loading branch information
barbosamaatheus committed Sep 14, 2021
1 parent e8511b3 commit 1580c0f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/main/java/br/unb/cic/analysis/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ private List<String> configurePackages() {
}

private List<String> getIncludeList() {
List<String> stringList = new ArrayList<String>(Arrays.asList("java.lang.*", "java.util.*")); //java.util.HashMap
//"java.lang.*"
List<String> stringList = new ArrayList<String>(Arrays.asList("java.util.*")); //java.util.HashMap
return stringList;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ private boolean containsValue(DataFlowAbstraction dataFlowAbstraction, Value val
return dataFlowAbstraction.getValue().equals(value);
}
if (dataFlowAbstraction.getValue() instanceof ArrayRef && value instanceof ArrayRef) {
return getArrayRefName(((ArrayRef) dataFlowAbstraction.getValue())).equals(getArrayRefName((ArrayRef) value));
return dataFlowAbstraction.getValue().equals(value);
}
if (dataFlowAbstraction.getValue() instanceof StaticFieldRef && value instanceof StaticFieldRef) {
return ((StaticFieldRef) dataFlowAbstraction.getValue()).getField().getName().equals(((StaticFieldRef) value).getField().getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,16 @@ public void subclassTest() {
Assert.assertEquals(0, analysis.getConflicts().size());
}

@Test
public void arrayConstantTest() {
String sampleClassPath = "br.unb.cic.analysis.samples.ioa.ArrayConstantSample";
AbstractMergeConflictDefinition definition = DefinitionFactory
.definition(sampleClassPath, new int[]{10}, new int[]{11});
InterproceduralOverrideAssignment analysis = new InterproceduralOverrideAssignment(definition);
configureTest(analysis);
Assert.assertEquals(1, analysis.getConflicts().size());
}

@Test
public void callGraphTest() {
String sampleClassPath = "br.unb.cic.analysis.samples.ioa.CallGraphSample";
Expand Down Expand Up @@ -214,7 +224,7 @@ public void classFieldWithParameterNotConflict() {

// Not Conflict - Not implemented yet. You will need constant propagation.
// Currently detected as conflict: [left, m():9] --> [right, foo():14]
Assert.assertEquals(1, analysis.getConflicts().size());
Assert.assertEquals(0, analysis.getConflicts().size());
}

@Test
Expand Down Expand Up @@ -251,7 +261,7 @@ public void localVariablesWithParameterNotConflict() {
public void additionToArrayConflict() {
String sampleClassPath = "br.unb.cic.analysis.samples.ioa.AdditionToArrayConflictSample";
AbstractMergeConflictDefinition definition = DefinitionFactory
.definition(sampleClassPath, new int[]{11}, new int[]{12});
.definition(sampleClassPath, new int[]{11}, new int[]{13});
InterproceduralOverrideAssignment analysis = new InterproceduralOverrideAssignment(definition);
configureTest(analysis);
Assert.assertEquals(58, analysis.getConflicts().size());
Expand Down Expand Up @@ -322,7 +332,7 @@ public void localArraysRecursiveNotConflict() {
public void classFieldArraysConflict() {
String sampleClassPath = "br.unb.cic.analysis.samples.ioa.ArraysClassFieldConflictSample";
AbstractMergeConflictDefinition definition = DefinitionFactory
.definition(sampleClassPath, new int[]{8}, new int[]{9});
.definition(sampleClassPath, new int[]{13}, new int[]{14});
InterproceduralOverrideAssignment analysis = new InterproceduralOverrideAssignment(definition);
configureTest(analysis);
Assert.assertEquals(1, analysis.getConflicts().size());
Expand Down

0 comments on commit 1580c0f

Please sign in to comment.