Skip to content

Slicing doesn't seem to handle aliases correctly #64

@thebesttv

Description

@thebesttv

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);
    }
}

Demo link.

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions