Skip to content

Commit

Permalink
Rename check
Browse files Browse the repository at this point in the history
  • Loading branch information
rickie committed Dec 18, 2023
1 parent 30777b3 commit 5a2b276
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ private static ImmutableList<Name> getVariables(LambdaExpressionTree tree) {
}

// XXX: Resolve this suppression.
@SuppressWarnings("ImportSuggestion")
@SuppressWarnings("UnqualifiedSuggestedFixImport")
private static Optional<SuggestedFix.Builder> constructFix(
LambdaExpressionTree lambdaExpr, Symbol target, Object methodName) {
Name sName = target.getSimpleName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,18 @@
@AutoService(BugChecker.class)
@BugPattern(
summary = "Avoid direct invocation of `SuggestedFix#add{,Static}Import`",
link = BUG_PATTERNS_BASE_URL + "ImportSuggestion",
link = BUG_PATTERNS_BASE_URL + "UnqualifiedSuggestedFixImport",
linkType = CUSTOM,
severity = WARNING,
tags = FRAGILE_CODE)
public final class ImportSuggestion extends BugChecker implements MethodInvocationTreeMatcher {
public final class UnqualifiedSuggestedFixImport extends BugChecker
implements MethodInvocationTreeMatcher {
private static final long serialVersionUID = 1L;
private static final Matcher<ExpressionTree> FIX_BUILDER_METHOD =
instanceMethod().onDescendantOf(SuggestedFix.Builder.class.getCanonicalName());

/** Instantiates a new {@link ImportSuggestion} instance. */
public ImportSuggestion() {}
/** Instantiates a new {@link UnqualifiedSuggestedFixImport} instance. */
public UnqualifiedSuggestedFixImport() {}

@Override
public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import com.google.errorprone.CompilationTestHelper;
import org.junit.jupiter.api.Test;

final class ImportSuggestionTest {
final class UnqualifiedSuggestedFixImportTest {
@Test
void identification() {
CompilationTestHelper.newInstance(ImportSuggestion.class, getClass())
CompilationTestHelper.newInstance(UnqualifiedSuggestedFixImport.class, getClass())
.expectErrorMessage(
"IMPORT",
m ->
Expand Down

0 comments on commit 5a2b276

Please sign in to comment.