Skip to content

Commit

Permalink
FindParseFailures: Null-safe
Browse files Browse the repository at this point in the history
  • Loading branch information
knutwannheden committed Jan 15, 2024
1 parent b716dc3 commit ef368c0
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import org.openrewrite.marker.Markup;
import org.openrewrite.table.ParseFailures;

import java.util.Objects;

@Value
@EqualsAndHashCode(callSuper = true)
public class FindParseFailures extends Recipe {
Expand Down Expand Up @@ -66,7 +68,7 @@ public TreeVisitor<?, ExecutionContext> getVisitor() {
public Tree postVisit(Tree tree, ExecutionContext ctx) {
return tree.getMarkers().findFirst(ParseExceptionResult.class)
.map(exceptionResult -> {
if (parserType != null && !exceptionResult.getParserType().equals(parserType)) {
if (parserType != null && !Objects.equals(exceptionResult.getParserType(), parserType)) {
return tree;
}

Expand Down

0 comments on commit ef368c0

Please sign in to comment.