Skip to content

Commit

Permalink
Handle all annotations with the simple name Generated in `-XepDisab…
Browse files Browse the repository at this point in the history
…leWarningsInGeneratedCode`

Follow-up to 4d6a0cc

See also #3094

PiperOrigin-RevId: 441545582
  • Loading branch information
cushon authored and Error Prone Team committed Apr 13, 2022
1 parent 7b6ae68 commit 47c2b05
Showing 1 changed file with 1 addition and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

package com.google.errorprone;

import static com.google.common.collect.ImmutableSet.toImmutableSet;

import com.google.common.collect.ImmutableSet;
import com.google.errorprone.annotations.CheckReturnValue;
import com.google.errorprone.annotations.Immutable;
Expand All @@ -37,7 +35,6 @@
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Stream;

/**
* Immutable container of "suppression signals" - annotations or other information gathered from
Expand All @@ -57,12 +54,6 @@ public class SuppressionInfo {
private static final Supplier<Name> ANDROID_SUPPRESS_LINT =
VisitorState.memoize(state -> state.getName("android.annotation.SuppressLint"));
private static final Supplier<Name> VALUE = VisitorState.memoize(state -> state.getName("value"));
private static final Supplier<ImmutableSet<Name>> GENERATED_ANNOTATIONS =
VisitorState.memoize(
state ->
Stream.of("javax.annotation.Generated", "javax.annotation.processing.Generated")
.map(state::getName)
.collect(toImmutableSet()));
private final ImmutableSet<String> suppressWarningsStrings;

@SuppressWarnings("Immutable") /* Name is javac's interned version of a string. */
Expand All @@ -78,7 +69,7 @@ private SuppressionInfo(
}

private static boolean isGenerated(Symbol sym, VisitorState state) {
return !ASTHelpers.annotationsAmong(sym, GENERATED_ANNOTATIONS.get(state), state).isEmpty();
return !ASTHelpers.getGeneratedBy(sym, state).isEmpty();
}

/**
Expand Down

0 comments on commit 47c2b05

Please sign in to comment.