JavaSlicer
JavaSlicer copied to clipboard
Slicing doesn't seem to handle aliases correctly
In the following program:
public class A {
int o;
public static void main(String[] args) {
A x = new A();
A y = x;
x.o = 1;
y.o = 2;
System.out.println(x.o);
}
}
slicing the x.o on the last line doesn't include the assignment to y.o:
public class A {
int o;
public static void main(String[] args) {
A x = new A();
x.o = 1;
System.out.println(x.o);
}
}
The sliced program doesn't seem to behave the same as the original one. I'm not sure if this is the intended behavior, could you explain a little? Thanks!
This is a known issue, the slicer is missing a points-to analysis, to determine which variables (may) point to the same object, and thus be considered a dependency. The basic trivial implementation for this example is not difficult, but I won't be including it until we have a complete implementation that covers non-concurrent Java. I will leave this issue open to track progress.
I've encountered a very similar problem in my usage of the slicer. Thank you @cargaji for confirming this issue and explaining the root cause. I really appreciate you keeping this open to track progress.