Skip to content

Commit 47c2b05

Browse files
cushonError Prone Team
authored and
Error Prone Team
committed
Handle all annotations with the simple name Generated in -XepDisableWarningsInGeneratedCode
Follow-up to 4d6a0cc See also #3094 PiperOrigin-RevId: 441545582
1 parent 7b6ae68 commit 47c2b05

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

check_api/src/main/java/com/google/errorprone/SuppressionInfo.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
package com.google.errorprone;
1818

19-
import static com.google.common.collect.ImmutableSet.toImmutableSet;
20-
2119
import com.google.common.collect.ImmutableSet;
2220
import com.google.errorprone.annotations.CheckReturnValue;
2321
import com.google.errorprone.annotations.Immutable;
@@ -37,7 +35,6 @@
3735
import java.util.HashSet;
3836
import java.util.Set;
3937
import java.util.concurrent.atomic.AtomicBoolean;
40-
import java.util.stream.Stream;
4138

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

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

8071
private static boolean isGenerated(Symbol sym, VisitorState state) {
81-
return !ASTHelpers.annotationsAmong(sym, GENERATED_ANNOTATIONS.get(state), state).isEmpty();
72+
return !ASTHelpers.getGeneratedBy(sym, state).isEmpty();
8273
}
8374

8475
/**

0 commit comments

Comments
 (0)