-
Notifications
You must be signed in to change notification settings - Fork 300
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
Fix logic for @Nullable annotation on type parameter #702
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pull Request Test Coverage Report for Build #1015
💛 - Coveralls |
lazaroclapp
approved these changes
Dec 23, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🚀
lazaroclapp
added a commit
that referenced
this pull request
Jan 4, 2023
This resolves #705 by broadening our slightly overzealous filtering from #702. We still want to filter type use annotations out when they happen on wildcards or type parameters. However, we can handle annotations on inner types (i.e. `Foo.@nullable Bar`). More importantly, these inner types appear implicitly in natural code involving inner classes, such as: ``` class Bar { @nullable Foo foo; // <- this is, implicitly Bar.@nullable Foo !! class Foo { } } ``` Not handling this case leads to confusing an unintuitive errors where a `@Nullable` annotation with a type use location will seemingly stop working for certain fields at random, if those fields are of an inner type. Additionally, as part of this fix, we restore the handling of type use annotations at the start of an array type as meaning the array object itself is `@Nullable` (i.e. `@Nullable Foo[] arr`, in addition to the correct type use form `Foo @nullable[] arr`). This is technically incorrect, but prohibiting it would break backwards compatibility with older versions of NullAway and surprise users, specially those switching from declaration annotations to type use annotations. See #708 for a full discussion of the tradeoffs and the path forward towards the proper semantics for type use annotations. Co-authored-by: Manu Sridharan <[email protected]>
msridhar
added a commit
to msridhar/NullAway
that referenced
this pull request
Jul 18, 2023
This reverts commit 5ccffb5.
msridhar
added a commit
to msridhar/NullAway
that referenced
this pull request
Jul 19, 2023
This reverts commit 5ccffb5.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We had logic to not consider type use annotations on type parameters when they appeared in return types, but not parameter types or field types.
Fixes #701