Skip to content

Commit c309a51

Browse files
refactor: Adopt J.Literal.isLiteralValue(expression, null) (#600)
Use this link to re-run the recipe: https://app.moderne.io/recipes/org.openrewrite.java.recipes.IsLiteralNullRecipe?organizationId=ODQ2MGExMTUtNDg0My00N2EwLTgzMGMtNGE1NGExMTBmZDkw Co-authored-by: Moderne <[email protected]>
1 parent c94a4a0 commit c309a51

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/org/openrewrite/staticanalysis/AnnotateNullableParameters.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,9 @@ private void handleCondition(Expression condition, Set<J.Identifier> nullChecked
198198
private void handleBinary(J.Binary binary, Set<J.Identifier> nullCheckedParams) {
199199
Expression maybeParam = null;
200200

201-
if (binary.getLeft() instanceof J.Literal && ((J.Literal) binary.getLeft()).getValue() == null) {
201+
if (J.Literal.isLiteralValue(binary.getLeft(), null)) {
202202
maybeParam = binary.getRight();
203-
} else if (binary.getRight() instanceof J.Literal && ((J.Literal) binary.getRight()).getValue() == null) {
203+
} else if (J.Literal.isLiteralValue(binary.getRight(), null)) {
204204
maybeParam = binary.getLeft();
205205
} else {
206206
handleCondition(binary.getLeft(), nullCheckedParams);

0 commit comments

Comments
 (0)