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

add SUGGEST_NULLABLE_ANNOTATIONS inspection #89

Merged
merged 1 commit into from
Jul 12, 2021

Conversation

thomasmahoney
Copy link
Contributor

@thomasmahoney thomasmahoney commented Jun 9, 2021

add ConstantConditions.SUGGEST_NULLABLE_ANNOTATIONS to inspections.

This inspection flags code that mixes @nullable values and non-@nullable params.

By Square Java convention, we treat unannotated method params as non-null by default.
Thus, code that mixes nullability in this way is likely incorrect, and creates an easy place for NPEs to hide.

With this change, a method call that passes a value IntelliJ determines to be possibly null into a method parameter not annotated as @nullable will be highlighted with the warning text, Argument '<some possibly-null expression>' might be null but passed to non-annotated parameter.

add ConstantConditions.SUGGEST_NULLABLE_ANNOTATIONS to inspections.

This inspection flags code that mixes `@Nullable` values and
non-`@Nullable` params. Such code is likely erroneous and a common
place for NPEs to hide.
@square square deleted a comment from thomasmahoney Jun 9, 2021
@swankjesse swankjesse merged commit 6cdf214 into square:main Jul 12, 2021
@thomasmahoney thomasmahoney deleted the patch-2 branch July 26, 2021 21:24
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

Successfully merging this pull request may close these issues.

4 participants