forked from spgroup/conflict-static-analysis
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
29127d4
commit e8511b3
Showing
3 changed files
with
35 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/test/java/br/unb/cic/analysis/samples/ioa/ArrayConstantSample.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package br.unb.cic.analysis.samples.ioa; | ||
|
||
// Conflict: [left, foo():15] --> [right, bar():19] | ||
public class ArrayConstantSample { | ||
|
||
private int[] arr; | ||
|
||
public static void main(String[] args) { | ||
ArrayConstantSample m = new ArrayConstantSample(); | ||
m.arr = new int[]{0, 0, 0, 0, 0}; | ||
m.foo(3); // LEFT | ||
m.bar(2); // RIGHT | ||
} | ||
|
||
private void foo(int i) { | ||
arr[i] = 1; | ||
} | ||
|
||
private void bar(int i) { | ||
arr[i] = 2; | ||
} | ||
|
||
} |
17 changes: 11 additions & 6 deletions
17
src/test/java/br/unb/cic/analysis/samples/ioa/ArraysClassFieldConflictSample.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,24 @@ | ||
package br.unb.cic.analysis.samples.ioa; | ||
|
||
// Conflict: [left, foo():13] --> [right, bar():17] | ||
// Conflict: [left, foo():14] --> [right, bar():18] | ||
public class ArraysClassFieldConflictSample { | ||
public static int[] y; | ||
public int[] y; | ||
|
||
public ArraysClassFieldConflictSample() { | ||
this.y = new int[]{0}; | ||
} | ||
|
||
public static void main(String[] args) { | ||
foo(); //left | ||
bar(); //right | ||
ArraysClassFieldConflictSample m = new ArraysClassFieldConflictSample(); | ||
m.foo(); //left | ||
m.bar(); //right | ||
} | ||
|
||
private static void foo() { | ||
private void foo() { | ||
y[0] = 3; | ||
} | ||
|
||
private static void bar() { | ||
private void bar() { | ||
y[0] = 4; | ||
} | ||
} |