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

Index flow of nullable back to upstream through a field write #211

Merged
merged 6 commits into from
Nov 2, 2023

Conversation

nimakarimipour
Copy link
Member

@nimakarimipour nimakarimipour commented Oct 27, 2023

This PR is built on (#210 landed)

Resolves #209 by indexing flow of nullable back to upstream through field writes. Previously we only indexed flow of nullable back to upstream via parameter passing, e.g. code below:

class Target{
    Object getFoo()
    void bar(Object param);
}
class Dependency {
    Target t;
    void baz(){
       t.bar(t.getFoo());
    }
}

We know that making getFoo() will trigger a fix on bar() parameter. This PR updates Annotator to index all flows back to upstream including field writes. Hence, in the code below:

class Target{
    Object bar;
    Object getFoo();
}
class Dependency {
    Target t;
    void baz(){
       t.bar = t.getFoo();
    }
}

Annotator now indexes the flow of nullable back to target through write to a field and includes the corresponding fix in the processing fix tree.

Please note this PR only updates indexing flow of nullable back to upstream. Annotator still does not index the impact of making public fields @Nullable on downstream dependencies.

@nimakarimipour nimakarimipour added the bug Something isn't working label Oct 27, 2023
@nimakarimipour nimakarimipour self-assigned this Oct 27, 2023
@nimakarimipour nimakarimipour linked an issue Oct 27, 2023 that may be closed by this pull request
@msridhar
Copy link
Member

Please note this PR only updates indexing flow of nullable back to upstream. Annotator still does not index the impact of making public fields @Nullable on downstream dependencies.

I don't understand the importance of this. Can not indexing the impact of making public fields @Nullable lead to similar bugs?

Copy link
Member

@msridhar msridhar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not deeply understand the changes, but from what I can tell, this bug was fixed mostly by deleting code and a bit of generalization, which is great!

@nimakarimipour
Copy link
Member Author

Please note this PR only updates indexing flow of nullable back to upstream. Annotator still does not index the impact of making public fields @Nullable on downstream dependencies.

I don't understand the importance of this. Can not indexing the impact of making public fields @Nullable lead to similar bugs?

@msridhar The bug here was that we were flowing back to upstream through field writes and Annotator was not extending the tree accordingly. Making fields @Nullable on upstream can potentially cause problems in downstream dependencies but Annotator is not aware of that and will not enter an unexpected state. Please note in strict mode, we do not re-build all downstream dependencies to ensure no new bug has been introduced. We on rely on the errors indexed in the downstream scan phase which happens prior to annotating process.

@nimakarimipour nimakarimipour merged commit f0574a1 into master Nov 2, 2023
@nimakarimipour nimakarimipour deleted the nimak/#209 branch November 2, 2023 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash by Precondition - Missing triggered fixes from downstream
2 participants