Slicer4J does not include in the slice function calls which indirectly affect criteria variables
ArtemUntila opened this issue · comments
Artem Untila commented
Main.java
:
1. import java.util.Arrays;
2.
3. public class Main {
4.
5. public static void main(String[] args) {
6. int[] a = new int[]{ 0, 1 };
7. a = addAndReturn(a);
8. add(a);
9. System.out.println(Arrays.toString(a));
10. }
11.
12. public static void add(int[] a) {
13. a[0] += 1;
14. }
15.
16. public static int[] addAndReturn(int[] a) {
17. a[0] += 1;
18. return a;
19. }
20. }
If we run the program, it outputs:
[2, 1]
Running Slicer4J w.r.t. Main:9
line, we get the following slice:
cd scripts
python3 slicer4j.py -j ../example.jar -o ../example -b Main:9 -m "Main"
slice.log
:
Main:6
Main:7
Main:17
Main:18
Main:9
Despite method add()
affecting the state of variable a
, it wasn’t included in the slice, and the sliced program prints:
[1, 1]
Khaled E. Ahmed commented
Thank you for bringing this to my attention. Fixed in the latest commit. Please also pull and build the latest commit of the DynamicSlicingCore.