diff --git a/src/main/java/br/unb/cic/analysis/Main.java b/src/main/java/br/unb/cic/analysis/Main.java index 0cde2804..5e861d94 100644 --- a/src/main/java/br/unb/cic/analysis/Main.java +++ b/src/main/java/br/unb/cic/analysis/Main.java @@ -258,7 +258,8 @@ private List configurePackages() { } private List getIncludeList() { - List stringList = new ArrayList(Arrays.asList("java.lang.*", "java.util.*")); //java.util.HashMap + //"java.lang.*" + List stringList = new ArrayList(Arrays.asList("java.util.*")); //java.util.HashMap return stringList; } diff --git a/src/main/java/br/unb/cic/analysis/ioa/InterproceduralOverrideAssignment.java b/src/main/java/br/unb/cic/analysis/ioa/InterproceduralOverrideAssignment.java index d1d7770f..79314071 100644 --- a/src/main/java/br/unb/cic/analysis/ioa/InterproceduralOverrideAssignment.java +++ b/src/main/java/br/unb/cic/analysis/ioa/InterproceduralOverrideAssignment.java @@ -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()); diff --git a/src/test/java/br/unb/cic/analysis/ioa/InterproceduralOverridingAssignmentAnalysisTest.java b/src/test/java/br/unb/cic/analysis/ioa/InterproceduralOverridingAssignmentAnalysisTest.java index 7184776a..ed6286b6 100644 --- a/src/test/java/br/unb/cic/analysis/ioa/InterproceduralOverridingAssignmentAnalysisTest.java +++ b/src/test/java/br/unb/cic/analysis/ioa/InterproceduralOverridingAssignmentAnalysisTest.java @@ -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"; @@ -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 @@ -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()); @@ -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());