Detect code that can be replaced by Objects.requireNonNullElse
/Objects.requireNonNullElseGet
#612
Labels
api
lints that check for code that reimplements parts of the api
enhancement
New feature or request
low-priority
new-lint
A new lint.
What it does
These two methods could be used to simplify some code:
where one checks if a
value
isnull
, thenreturn
s/break
s/assigns a default value or calls some code or otherwise uses the non-null value.The amount of code that triggers this lint, is likely minimal, especially, when
Objects.requireNonNullElseGet
cannot be suggested, which makes this a low-priority issue.Lint Name
USE_OBJECTS_REQUIRE_NON_NULL
Category
api
Example
Could be written as:
The text was updated successfully, but these errors were encountered: