Skip to content
This repository was archived by the owner on Nov 19, 2025. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants