Repository navigation
Ignoring library models return nullability on first-party code. - #446
Merged
Merged
Conversation
Contributor
Author
|
Not to be landed yet, running internal tests. |
Pull Request Test Coverage Report for Build #478
💛 - Coveralls |
msridhar
approved these changes
Feb 20, 2021
msridhar
left a comment
Contributor
There was a problem hiding this comment.
LGTM, one suggestion on tests
| " NonNullGetMessage(final String message) {", | ||
| " super(message);", | ||
| " }", | ||
| " @Override", |
Contributor
There was a problem hiding this comment.
Do we want to write a test that we report an error when there is an override of getMessage() with no annotations and it returns null?
By definition, library models are designed to handle third-party libraries. However, as currently implemented, a library model indicating an `@Nullable` return will apply to all subtypes of the type in the model, including those in first-party code. This change fixes that, ignoring library models information whenever code is marked as unannotated. See #445 for a discussion. Generally, the principle behind this is that a method in "annotated" code without an `@Nullable` annotation should never magically just be considered to return `@Nullable` implicitly, which is what the current/previous behavior regarding library models did.
lazaroclapp
force-pushed
the
lazaro_repro_nullness_check_confusion
branch
from
February 22, 2021 23:10
0ecb41c to
f0c8eb7
Compare
This file contains hidden or 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
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.
By definition, library models are designed to handle third-party
libraries. However, as currently implemented, a library model
indicating an
@Nullablereturn will apply to all subtypes ofthe type in the model, including those in first-party code.
This change fixes that, ignoring library models information
whenever code is marked as unannotated.
See #445 for a discussion.
Generally, the principle behind this is that a method in
"annotated" code without an
@Nullableannotation shouldnever magically just be considered to return
@Nullableimplicitly, which is what the current/previous behavior
regarding library models did.