diff --git a/core/src/main/java/com/google/errorprone/bugpatterns/nullness/ReturnMissingNullable.java b/core/src/main/java/com/google/errorprone/bugpatterns/nullness/ReturnMissingNullable.java index e06bc53213b4..2f32a9dc2f07 100644 --- a/core/src/main/java/com/google/errorprone/bugpatterns/nullness/ReturnMissingNullable.java +++ b/core/src/main/java/com/google/errorprone/bugpatterns/nullness/ReturnMissingNullable.java @@ -62,7 +62,6 @@ import com.sun.source.tree.MethodTree; import com.sun.source.tree.ReturnTree; import com.sun.source.tree.StatementTree; -import com.sun.source.tree.Tree; import com.sun.source.tree.VariableTree; import com.sun.source.util.TreePathScanner; import com.sun.tools.javac.code.Symbol; @@ -230,7 +229,7 @@ void doVisitVariable(VariableTree tree) { }.scan(tree, null); ImmutableSet definitelyNullVars = definitelyNullVarsBuilder.build(); - new TreePathScanner() { + new SuppressibleTreePathScanner(stateForCompilationUnit) { @Override public Void visitBlock(BlockTree block, Void unused) { for (StatementTree statement : block.getStatements()) { @@ -398,14 +397,6 @@ && methodCanBeOverridden(method)) { } } } - - @Override - public Void scan(Tree tree, Void unused) { - if (isSuppressed(tree, stateForCompilationUnit)) { - return null; - } - return super.scan(tree, unused); - } }.scan(tree, null); return NO_MATCH; // Any reports were made through state.reportMatch.