Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OA INTER] add treatment for empty builders #41

Closed
barbosamaatheus opened this issue May 11, 2021 · 1 comment
Closed

[OA INTER] add treatment for empty builders #41

barbosamaatheus opened this issue May 11, 2021 · 1 comment

Comments

@barbosamaatheus
Copy link
Collaborator

When using default builders, the jimple does not initialize the attributes with defult values. Thus, in cases where we expect a defult assignment to the contractor to detect possible conflicts, the analysis does not work.

... {
public void m() {
        this.instanceAttributeSample = new InstanceAttributeSample(); // LEFT
        instanceAttributeSample.setFoo(2); // RIGHT
    }
}

class InstanceAttributeSample {
    private int att;

    public void setFoo(int foo) {
        this.att = foo;
    }
} 

In the example above, a conflict is expected because the execution of the LEFT line writes to instanceAttributeSample.att, and the execution of the RIGHT line also writes to instanceAttributeSample.att, so both change the same component.

So we're going to have a problem.
In this case, using the default constructor, the generated jimple has no assignment to the "att" attribute on the left line.

As a solution, in this case, whenever we find a default constructor, we must add in the abstraction all the attributes of the class.

@barbosamaatheus
Copy link
Collaborator Author

Já implementado

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant