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 fb609a96..847982e5 100644 --- a/src/test/java/br/unb/cic/analysis/ioa/InterproceduralOverridingAssignmentAnalysisTest.java +++ b/src/test/java/br/unb/cic/analysis/ioa/InterproceduralOverridingAssignmentAnalysisTest.java @@ -2,7 +2,9 @@ import br.unb.cic.analysis.AbstractMergeConflictDefinition; import br.unc.cic.analysis.test.DefinitionFactory; +import br.unc.cic.analysis.test.MarkingClass; import org.junit.Assert; +import org.junit.Ignore; import org.junit.Test; import soot.G; import soot.PackManager; @@ -58,13 +60,13 @@ private List getIncludeList() { private static void enableSparkCallGraph() { //Enable Spark HashMap opt = new HashMap(); - //opt.put("propagator","worklist"); - //opt.put("simple-edges-bidirectional","false"); + opt.put("propagator", "worklist"); // + opt.put("simple-edges-bidirectional", "false"); // opt.put("on-fly-cg", "true"); - //opt.put("set-impl","double"); - //opt.put("double-set-old","hybrid"); - //opt.put("double-set-new","hybrid"); - //opt.put("pre_jimplify", "true"); + opt.put("set-impl", "double"); // + opt.put("double-set-old", "hybrid"); // + opt.put("double-set-new", "hybrid"); // + opt.put("pre_jimplify", "true"); // SparkTransformer.v().transform("", opt); } @@ -86,12 +88,20 @@ private void configureSootOptions(List testClasses) { @Test public void subclassWithConditionalTeste() { - String sampleClassPath = "br.unb.cic.analysis.samples.ioa.SubclassWithConditionalNotConflictSample"; - AbstractMergeConflictDefinition definition = DefinitionFactory - .definition(sampleClassPath, new int[]{7,28}, new int[]{37}); + + MarkingClass subclassWithConditionalNotConflictSample = new MarkingClass("br.unb.cic.analysis.samples.ioa" + + ".SubclassWithConditionalNotConflictSample", new int[]{7}, new int[]{}); + MarkingClass c = new MarkingClass("br.unb.cic.analysis.samples.ioa.C", new int[]{27}, new int[]{}); + MarkingClass d = new MarkingClass("br.unb.cic.analysis.samples.ioa.D", new int[]{}, new int[]{36}); + + List markingClassList = Arrays.asList(subclassWithConditionalNotConflictSample, c, + d); + + AbstractMergeConflictDefinition definition = DefinitionFactory.definition(markingClassList, false); + InterproceduralOverrideAssignment analysis = new InterproceduralOverrideAssignment(definition); configureTest(analysis); - Assert.assertEquals(1, analysis.getConflicts().size()); + Assert.assertEquals(0, analysis.getConflicts().size()); } @Test @@ -101,7 +111,7 @@ public void subclassTest() { .definition(sampleClassPath, new int[]{7}, new int[]{8}); InterproceduralOverrideAssignment analysis = new InterproceduralOverrideAssignment(definition); configureTest(analysis); - Assert.assertEquals(1, analysis.getConflicts().size()); + Assert.assertEquals(0, analysis.getConflicts().size()); } @Test @@ -134,6 +144,7 @@ public void containsInvokeExp() { Assert.assertEquals(1, analysis.getConflicts().size()); } + @Ignore @Test public void chainedMethodCallsConflict() { String sampleClassPath = "br.unb.cic.analysis.samples.ioa.ChainedMethodCallsConflictSample"; @@ -158,7 +169,7 @@ public void bothMarkingConflict() { public void classFieldConflict() { String sampleClassPath = "br.unb.cic.analysis.samples.ioa.OverridingAssignmentClassFieldConflictInterProceduralSample"; AbstractMergeConflictDefinition definition = DefinitionFactory - .definition(sampleClassPath, new int[]{8}, new int[]{9}); + .definition(sampleClassPath, new int[]{10}, new int[]{11}); InterproceduralOverrideAssignment analysis = new InterproceduralOverrideAssignment(definition); configureTest(analysis); Assert.assertEquals(1, analysis.getConflicts().size()); @@ -168,7 +179,7 @@ public void classFieldConflict() { public void classFieldConflict2() { String sampleClassPath = "br.unb.cic.analysis.samples.ioa.OverridingAssignmentClassFieldConflictInterProceduralSample2"; AbstractMergeConflictDefinition definition = DefinitionFactory - .definition(sampleClassPath, new int[]{8}, new int[]{9}); + .definition(sampleClassPath, new int[]{10}, new int[]{11}); InterproceduralOverrideAssignment analysis = new InterproceduralOverrideAssignment(definition); configureTest(analysis); Assert.assertEquals(1, analysis.getConflicts().size()); @@ -198,7 +209,7 @@ public void classFieldNotConflict2() { public void classFieldWithParameterNotConflict() { String sampleClassPath = "br.unb.cic.analysis.samples.ioa.OverridingAssignmentClassFieldWithParameterNotConflictInterProceduralSample"; AbstractMergeConflictDefinition definition = DefinitionFactory - .definition(sampleClassPath, new int[]{9}, new int[]{10}); + .definition(sampleClassPath, new int[]{11}, new int[]{12}); InterproceduralOverrideAssignment analysis = new InterproceduralOverrideAssignment(definition); configureTest(analysis); @@ -237,6 +248,7 @@ public void localVariablesWithParameterNotConflict() { Assert.assertEquals(0, analysis.getConflicts().size()); } + @Ignore @Test public void additionToArrayConflict() { String sampleClassPath = "br.unb.cic.analysis.samples.ioa.OverridingAssignmentAdditionToArrayConflictInterProceduralSample"; @@ -247,6 +259,7 @@ public void additionToArrayConflict() { Assert.assertEquals(57, analysis.getConflicts().size()); } + @Ignore @Test public void hashmapConflict() { String sampleClassPath = "br.unb.cic.analysis.samples.ioa.OverridingAssignmentHashmapConflictInterProceduralSample"; @@ -272,7 +285,7 @@ public void changePublicAttributesConflict() { public void changeInstanceAttributeConflict() { String sampleClassPath = "br.unb.cic.analysis.samples.ioa.OverridingAssignmentChangeInstanceAttributeConflictInterProceduralSample"; AbstractMergeConflictDefinition definition = DefinitionFactory - .definition(sampleClassPath, new int[]{8}, new int[]{9}); + .definition(sampleClassPath, new int[]{11}, new int[]{12}); InterproceduralOverrideAssignment analysis = new InterproceduralOverrideAssignment(definition); configureTest(analysis); Assert.assertEquals(1, analysis.getConflicts().size()); @@ -322,7 +335,7 @@ public void classFieldArraysNotConflict() { public void classFieldArraysAliasingConflict() { String sampleClassPath = "br.unb.cic.analysis.samples.ioa.OverridingAssignmentArrayAliasingConflictInterProceduralSample"; AbstractMergeConflictDefinition definition = DefinitionFactory - .definition(sampleClassPath, new int[]{10}, new int[]{11}); + .definition(sampleClassPath, new int[]{12}, new int[]{13}); InterproceduralOverrideAssignment analysis = new InterproceduralOverrideAssignment(definition); configureTest(analysis); Assert.assertEquals(1, analysis.getConflicts().size()); @@ -342,7 +355,7 @@ public void arrayDiferentIndexNotConflict() { public void arraySameIndexConflict() { String sampleClassPath = "br.unb.cic.analysis.samples.ioa.ArraySameIndexConflictSample"; AbstractMergeConflictDefinition definition = DefinitionFactory - .definition(sampleClassPath, new int[]{9}, new int[]{10}); + .definition(sampleClassPath, new int[]{10}, new int[]{11}); InterproceduralOverrideAssignment analysis = new InterproceduralOverrideAssignment(definition); configureTest(analysis); Assert.assertEquals(1, analysis.getConflicts().size()); @@ -432,7 +445,7 @@ public void sameAttributeOnIdenticalClass() { public void concatMethodsConflict() { String sampleClassPath = "br.unb.cic.analysis.samples.ioa.OverridingAssignmentConcatMethodsConflictInterProceduralSample"; AbstractMergeConflictDefinition definition = DefinitionFactory - .definition(sampleClassPath, new int[]{7}, new int[]{8}); + .definition(sampleClassPath, new int[]{10}, new int[]{11}); InterproceduralOverrideAssignment analysis = new InterproceduralOverrideAssignment(definition); configureTest(analysis); Assert.assertEquals(1, analysis.getConflicts().size()); @@ -442,7 +455,7 @@ public void concatMethodsConflict() { public void ifBranchConflict() { String sampleClassPath = "br.unb.cic.analysis.samples.ioa.OverridingAssignmentIfBranchConflictInterProceduralSample"; AbstractMergeConflictDefinition definition = DefinitionFactory - .definition(sampleClassPath, new int[]{8}, new int[]{9}); + .definition(sampleClassPath, new int[]{10}, new int[]{11}); InterproceduralOverrideAssignment analysis = new InterproceduralOverrideAssignment(definition); configureTest(analysis); Assert.assertEquals(1, analysis.getConflicts().size()); @@ -468,11 +481,21 @@ public void sequenceConflict2() { Assert.assertEquals(1, analysis.getConflicts().size()); } + @Test + public void recursiveCallConflict() { + String sampleClassPath = "br.unb.cic.analysis.samples.ioa.RecursiveCallConflictSample"; + AbstractMergeConflictDefinition definition = DefinitionFactory + .definition(sampleClassPath, new int[]{8}, new int[]{15}); + InterproceduralOverrideAssignment analysis = new InterproceduralOverrideAssignment(definition); + configureTest(analysis); + Assert.assertEquals(2, analysis.getConflicts().size()); + } + @Test public void recursiveMockupConflict() { String sampleClassPath = "br.unb.cic.analysis.samples.ioa.RecursiveMockupConflictSample"; AbstractMergeConflictDefinition definition = DefinitionFactory - .definition(sampleClassPath, new int[]{8}, new int[]{9}); + .definition(sampleClassPath, new int[]{9}, new int[]{10}); InterproceduralOverrideAssignment analysis = new InterproceduralOverrideAssignment(definition); configureTest(analysis); Assert.assertEquals(3, analysis.getConflicts().size()); diff --git a/src/test/java/br/unb/cic/analysis/samples/ioa/ArraySameIndexConflictSample.java b/src/test/java/br/unb/cic/analysis/samples/ioa/ArraySameIndexConflictSample.java index 8b1e9480..dde0652f 100644 --- a/src/test/java/br/unb/cic/analysis/samples/ioa/ArraySameIndexConflictSample.java +++ b/src/test/java/br/unb/cic/analysis/samples/ioa/ArraySameIndexConflictSample.java @@ -4,10 +4,11 @@ public class ArraySameIndexConflictSample { private int[] arr; - public void m() { - arr = new int[]{0, 0, 0, 0, 0}; - foo(); // LEFT - bar(); // RIGHT + public static void main(String[] args) { + ArraySameIndexConflictSample m = new ArraySameIndexConflictSample(); + m.arr = new int[]{0, 0, 0, 0, 0}; + m.foo(); // LEFT + m.bar(); // RIGHT } private void foo() { diff --git a/src/test/java/br/unb/cic/analysis/samples/ioa/BothMarkingConflictSample.java b/src/test/java/br/unb/cic/analysis/samples/ioa/BothMarkingConflictSample.java index cbc6a519..da66bdca 100644 --- a/src/test/java/br/unb/cic/analysis/samples/ioa/BothMarkingConflictSample.java +++ b/src/test/java/br/unb/cic/analysis/samples/ioa/BothMarkingConflictSample.java @@ -2,14 +2,15 @@ // Conflict: [left, foo():12] --> [right, foo():12] public class BothMarkingConflictSample { - private int x; + private static int x; - public void m() { - foo(); // LEFT // RIGHT + public void main() { + foo(); } - private void foo() { - this.x = 1; + + private static void foo() { + x = 1; // RIGHT } } \ No newline at end of file diff --git a/src/test/java/br/unb/cic/analysis/samples/ioa/IfWithInvokeConflictSample.java b/src/test/java/br/unb/cic/analysis/samples/ioa/IfWithInvokeConflictSample.java index ac93f3c7..0bbbada2 100644 --- a/src/test/java/br/unb/cic/analysis/samples/ioa/IfWithInvokeConflictSample.java +++ b/src/test/java/br/unb/cic/analysis/samples/ioa/IfWithInvokeConflictSample.java @@ -4,11 +4,12 @@ public class IfWithInvokeConflictSample { private int x, y; - public void m() { - x = 0; // LEFT - y = 0; - if (foo()) { // RIGHT - y = 1; + public static void main(String[] args) { + IfWithInvokeConflictSample m = new IfWithInvokeConflictSample(); + m.x = 0; // LEFT + m.y = 0; + if (m.foo()) { // RIGHT + m.y = 1; } } diff --git a/src/test/java/br/unb/cic/analysis/samples/ioa/OverridingAssignmentArrayAliasingConflictInterProceduralSample.java b/src/test/java/br/unb/cic/analysis/samples/ioa/OverridingAssignmentArrayAliasingConflictInterProceduralSample.java index 6d044527..f6c1c9bf 100644 --- a/src/test/java/br/unb/cic/analysis/samples/ioa/OverridingAssignmentArrayAliasingConflictInterProceduralSample.java +++ b/src/test/java/br/unb/cic/analysis/samples/ioa/OverridingAssignmentArrayAliasingConflictInterProceduralSample.java @@ -4,11 +4,13 @@ public class OverridingAssignmentArrayAliasingConflictInterProceduralSample { private int[] arr, barr; - public void m() { - arr = new int[]{0, 0, 0, 0, 0}; - barr = arr; - foo(); // LEFT - bar(); // RIGHT + public static void main(String[] args) { + OverridingAssignmentArrayAliasingConflictInterProceduralSample m = + new OverridingAssignmentArrayAliasingConflictInterProceduralSample(); + m.arr = new int[]{0, 0, 0, 0, 0}; + m.barr = m.arr; + m.foo(); // LEFT + m.bar(); // RIGHT } private void foo() { diff --git a/src/test/java/br/unb/cic/analysis/samples/ioa/OverridingAssignmentChangeInstanceAttributeConflictInterProceduralSample.java b/src/test/java/br/unb/cic/analysis/samples/ioa/OverridingAssignmentChangeInstanceAttributeConflictInterProceduralSample.java index 6c47ed0d..2b03a053 100644 --- a/src/test/java/br/unb/cic/analysis/samples/ioa/OverridingAssignmentChangeInstanceAttributeConflictInterProceduralSample.java +++ b/src/test/java/br/unb/cic/analysis/samples/ioa/OverridingAssignmentChangeInstanceAttributeConflictInterProceduralSample.java @@ -4,9 +4,12 @@ public class OverridingAssignmentChangeInstanceAttributeConflictInterProceduralSample { private InstanceAttributeSample instanceAttributeSample; - public void m() { - this.instanceAttributeSample = new InstanceAttributeSample(); // LEFT - instanceAttributeSample.setFoo(2); // RIGHT + public static void main(String[] args) { + OverridingAssignmentChangeInstanceAttributeConflictInterProceduralSample m = + new OverridingAssignmentChangeInstanceAttributeConflictInterProceduralSample(); + + m.instanceAttributeSample = new InstanceAttributeSample(); // LEFT + m.instanceAttributeSample.setFoo(2); // RIGHT } } diff --git a/src/test/java/br/unb/cic/analysis/samples/ioa/OverridingAssignmentClassFieldConflictInterProceduralSample.java b/src/test/java/br/unb/cic/analysis/samples/ioa/OverridingAssignmentClassFieldConflictInterProceduralSample.java index 61fc263e..e7d4d0e3 100644 --- a/src/test/java/br/unb/cic/analysis/samples/ioa/OverridingAssignmentClassFieldConflictInterProceduralSample.java +++ b/src/test/java/br/unb/cic/analysis/samples/ioa/OverridingAssignmentClassFieldConflictInterProceduralSample.java @@ -4,14 +4,14 @@ public class OverridingAssignmentClassFieldConflictInterProceduralSample { private int x; - public void m() { - x = 0; // LEFT - foo(); // RIGHT + public static void main(String[] args) { + OverridingAssignmentClassFieldConflictInterProceduralSample m = + new OverridingAssignmentClassFieldConflictInterProceduralSample(); + m.x = 0; // LEFT + m.foo(); // RIGHT } private void foo() { x = 1; } - - } \ No newline at end of file diff --git a/src/test/java/br/unb/cic/analysis/samples/ioa/OverridingAssignmentClassFieldConflictInterProceduralSample2.java b/src/test/java/br/unb/cic/analysis/samples/ioa/OverridingAssignmentClassFieldConflictInterProceduralSample2.java index 26cbb476..c5e5ba75 100644 --- a/src/test/java/br/unb/cic/analysis/samples/ioa/OverridingAssignmentClassFieldConflictInterProceduralSample2.java +++ b/src/test/java/br/unb/cic/analysis/samples/ioa/OverridingAssignmentClassFieldConflictInterProceduralSample2.java @@ -4,9 +4,11 @@ public class OverridingAssignmentClassFieldConflictInterProceduralSample2 { private int x; - public void m() { - foo(); // LEFT - bar(); // RIGHT + public static void main(String[] args) { + OverridingAssignmentClassFieldConflictInterProceduralSample2 m = + new OverridingAssignmentClassFieldConflictInterProceduralSample2(); + m.foo(); // LEFT + m.bar(); // RIGHT } private void foo() { diff --git a/src/test/java/br/unb/cic/analysis/samples/ioa/OverridingAssignmentClassFieldWithParameterNotConflictInterProceduralSample.java b/src/test/java/br/unb/cic/analysis/samples/ioa/OverridingAssignmentClassFieldWithParameterNotConflictInterProceduralSample.java index d1bb4adf..a1b9ea10 100644 --- a/src/test/java/br/unb/cic/analysis/samples/ioa/OverridingAssignmentClassFieldWithParameterNotConflictInterProceduralSample.java +++ b/src/test/java/br/unb/cic/analysis/samples/ioa/OverridingAssignmentClassFieldWithParameterNotConflictInterProceduralSample.java @@ -5,9 +5,11 @@ public class OverridingAssignmentClassFieldWithParameterNotConflictInterProceduralSample { private int x; - public void m() { - x = 0; // LEFT - foo(x); // RIGHT + public static void main(String[] args) { + OverridingAssignmentClassFieldWithParameterNotConflictInterProceduralSample m = + new OverridingAssignmentClassFieldWithParameterNotConflictInterProceduralSample(); + m.x = 0; // LEFT + m.foo(m.x); // RIGHT } private void foo(int a) { diff --git a/src/test/java/br/unb/cic/analysis/samples/ioa/OverridingAssignmentConcatMethodsConflictInterProceduralSample.java b/src/test/java/br/unb/cic/analysis/samples/ioa/OverridingAssignmentConcatMethodsConflictInterProceduralSample.java index e1d00bf4..8ccdfbd0 100644 --- a/src/test/java/br/unb/cic/analysis/samples/ioa/OverridingAssignmentConcatMethodsConflictInterProceduralSample.java +++ b/src/test/java/br/unb/cic/analysis/samples/ioa/OverridingAssignmentConcatMethodsConflictInterProceduralSample.java @@ -3,9 +3,12 @@ // Conflict: [left, m():7] --> [right, foo():8] public class OverridingAssignmentConcatMethodsConflictInterProceduralSample { - public void m() { - int x = foo() + bar(); // LEFT i3 = $i0 + $i1 - x = $stack2 + $stack3 - x = x + qux(); // RIGHT i4 = i3 + $i2 - x = x + $stack4 + public static void main(String[] args) { + OverridingAssignmentConcatMethodsConflictInterProceduralSample m = + new OverridingAssignmentConcatMethodsConflictInterProceduralSample(); + + int x = m.foo() + m.bar(); // LEFT i3 = $i0 + $i1 - x = $stack2 + $stack3 + x = x + m.qux(); // RIGHT i4 = i3 + $i2 - x = x + $stack4 } private int foo() { diff --git a/src/test/java/br/unb/cic/analysis/samples/ioa/OverridingAssignmentDifferentMethodOnIdenticalClassConflictInterProceduralSample.java b/src/test/java/br/unb/cic/analysis/samples/ioa/OverridingAssignmentDifferentMethodOnIdenticalClassConflictInterProceduralSample.java index 5363f905..376f63e9 100644 --- a/src/test/java/br/unb/cic/analysis/samples/ioa/OverridingAssignmentDifferentMethodOnIdenticalClassConflictInterProceduralSample.java +++ b/src/test/java/br/unb/cic/analysis/samples/ioa/OverridingAssignmentDifferentMethodOnIdenticalClassConflictInterProceduralSample.java @@ -4,13 +4,13 @@ public class OverridingAssignmentDifferentMethodOnIdenticalClassConflictInterProceduralSample { private IdenticalClassSample identicalClassSample; - public OverridingAssignmentDifferentMethodOnIdenticalClassConflictInterProceduralSample() { - this.identicalClassSample = new IdenticalClassSample(); - } + public static void main(String[] args) { + OverridingAssignmentDifferentMethodOnIdenticalClassConflictInterProceduralSample m = + new OverridingAssignmentDifferentMethodOnIdenticalClassConflictInterProceduralSample(); - public void m() { - identicalClassSample.setFoo(1); // LEFT - identicalClassSample.setBar(2); // RIGHT + m.identicalClassSample = new IdenticalClassSample(); + m.identicalClassSample.setFoo(1); // LEFT + m.identicalClassSample.setBar(2); // RIGHT } } diff --git a/src/test/java/br/unb/cic/analysis/samples/ioa/OverridingAssignmentIfBranchConflictInterProceduralSample.java b/src/test/java/br/unb/cic/analysis/samples/ioa/OverridingAssignmentIfBranchConflictInterProceduralSample.java index dd3f4bad..5c1abede 100644 --- a/src/test/java/br/unb/cic/analysis/samples/ioa/OverridingAssignmentIfBranchConflictInterProceduralSample.java +++ b/src/test/java/br/unb/cic/analysis/samples/ioa/OverridingAssignmentIfBranchConflictInterProceduralSample.java @@ -4,9 +4,11 @@ public class OverridingAssignmentIfBranchConflictInterProceduralSample { private int x; - public void m() { - x = 0; // LEFT - foo(); // RIGHT + public static void main() { + OverridingAssignmentIfBranchConflictInterProceduralSample m = + new OverridingAssignmentIfBranchConflictInterProceduralSample(); + m.x = 0; // LEFT + m.foo(); // RIGHT } private void foo() { @@ -16,6 +18,5 @@ private void foo() { int a = 0; // System.out.println(x) } - ; } } \ No newline at end of file diff --git a/src/test/java/br/unb/cic/analysis/samples/ioa/OverridingAssignmentObjectThreeFieldsOneConflictInterProceduralSample.java b/src/test/java/br/unb/cic/analysis/samples/ioa/OverridingAssignmentObjectThreeFieldsOneConflictInterProceduralSample.java index c5d59320..e724772d 100644 --- a/src/test/java/br/unb/cic/analysis/samples/ioa/OverridingAssignmentObjectThreeFieldsOneConflictInterProceduralSample.java +++ b/src/test/java/br/unb/cic/analysis/samples/ioa/OverridingAssignmentObjectThreeFieldsOneConflictInterProceduralSample.java @@ -7,16 +7,16 @@ public class OverridingAssignmentObjectThreeFieldsOneConflictInterProceduralSamp public OverridingAssignmentInstance2 a; public OverridingAssignmentInstance2 b; - public OverridingAssignmentObjectThreeFieldsOneConflictInterProceduralSample instanceLocal; + public static OverridingAssignmentObjectThreeFieldsOneConflictInterProceduralSample instanceLocal; - public void m() { + public static void main(String[] args) { instanceLocal = new OverridingAssignmentObjectThreeFieldsOneConflictInterProceduralSample(); - foo(); // left - bar(); // right in {instanceLocal.b.a.a, instanceLocal.b.a.b } - base(); // base - baz(); //left - qux(); //right + instanceLocal.foo(); // left + instanceLocal.bar(); // right in {instanceLocal.b.a.a, instanceLocal.b.a.b } + instanceLocal.base(); // base + instanceLocal.baz(); //left + instanceLocal.qux(); //right } private void foo() { diff --git a/src/test/java/br/unb/cic/analysis/samples/ioa/RecursiveCallConflictSample.java b/src/test/java/br/unb/cic/analysis/samples/ioa/RecursiveCallConflictSample.java new file mode 100644 index 00000000..0e3dd70c --- /dev/null +++ b/src/test/java/br/unb/cic/analysis/samples/ioa/RecursiveCallConflictSample.java @@ -0,0 +1,17 @@ +package br.unb.cic.analysis.samples.ioa; + +// Conflict: [left, foo():13] --> [right, foo():13] +public class RecursiveCallConflictSample { + + public static void main(String[] args) { + RecursiveCallConflictSample recursiveCallConflictSample = new RecursiveCallConflictSample(); + recursiveCallConflictSample.foo(1); // LEFT + } + + private int foo(int n) { + if (n == 1) { + return n; + } + return foo(n - 1) * n; // RIGHT + } +} \ No newline at end of file diff --git a/src/test/java/br/unb/cic/analysis/samples/ioa/RecursiveMockupConflictSample.java b/src/test/java/br/unb/cic/analysis/samples/ioa/RecursiveMockupConflictSample.java index f6d244ea..97907ed9 100644 --- a/src/test/java/br/unb/cic/analysis/samples/ioa/RecursiveMockupConflictSample.java +++ b/src/test/java/br/unb/cic/analysis/samples/ioa/RecursiveMockupConflictSample.java @@ -4,9 +4,10 @@ public class RecursiveMockupConflictSample { private int x; - public void m() { - foo(); // LEFT - foo(); // Right + public static void main(String[] args) { + RecursiveMockupConflictSample m = new RecursiveMockupConflictSample(); + m.foo(); // LEFT + m.foo(); // Right } private void foo() { diff --git a/src/test/java/br/unb/cic/analysis/samples/ioa/SubclassWithConditionalNotConflictSample.java b/src/test/java/br/unb/cic/analysis/samples/ioa/SubclassWithConditionalNotConflictSample.java index 06dee485..f542cbf1 100644 --- a/src/test/java/br/unb/cic/analysis/samples/ioa/SubclassWithConditionalNotConflictSample.java +++ b/src/test/java/br/unb/cic/analysis/samples/ioa/SubclassWithConditionalNotConflictSample.java @@ -16,16 +16,21 @@ public static void m(boolean b) { } c.m(); } - } class C { public int x; - C(){ + + C() { this.x = 0; } + public void m() { - this.x = 1; // LEFT + foo(); // LEFT + } + + public void foo() { + this.x = 1; // LEFT } }