Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.google.errorprone.VisitorState;
import com.sun.source.tree.Tree;
import com.sun.source.util.TreeScanner;
import org.jspecify.annotations.Nullable;

/**
* A matcher that recursively inspects a tree, applying the given matcher to all levels of each tree
Expand All @@ -42,8 +43,11 @@ public boolean matches(Tree tree, VisitorState state) {
private boolean matchFound = false;

@Override
public Void scan(Tree tree, Void unused) {
if (matchFound || matcher.matches(tree, state)) {
public Void scan(@Nullable Tree tree, Void unused) {
if (tree == null || matchFound) {
return null;
}
if (matcher.matches(tree, state)) {
matchFound = true;
return null;
}
Expand Down
Loading