Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Handle all annotations with the simple name Generated in -XepDisableWarningsInGeneratedCode #3108

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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 @@ -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