From 94b28fbdd2f55ef71d5f21db78b81cf363f769dc Mon Sep 17 00:00:00 2001 From: Stephan Schroevers Date: Sat, 2 Sep 2023 19:13:55 +0200 Subject: [PATCH 1/2] Flag unused Refaster template parameters --- .../java/com/google/errorprone/bugpatterns/UnusedVariable.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/src/main/java/com/google/errorprone/bugpatterns/UnusedVariable.java b/core/src/main/java/com/google/errorprone/bugpatterns/UnusedVariable.java index cd41fac6081..fa3c50bbbb4 100644 --- a/core/src/main/java/com/google/errorprone/bugpatterns/UnusedVariable.java +++ b/core/src/main/java/com/google/errorprone/bugpatterns/UnusedVariable.java @@ -149,6 +149,8 @@ public final class UnusedVariable extends BugChecker implements CompilationUnitT // TODO(ghm): Find a sensible place to dedupe this with UnnecessarilyVisible. private static final ImmutableSet ANNOTATIONS_INDICATING_PARAMETERS_SHOULD_BE_CHECKED = ImmutableSet.of( + "com.google.errorprone.refaster.annotation.AfterTemplate", + "com.google.errorprone.refaster.annotation.BeforeTemplate", "com.google.inject.Inject", "com.google.inject.Provides", "com.google.inject.multibindings.ProvidesIntoMap", From 3fe50406ce7a5e70d15602468ae99ea7488f0ec5 Mon Sep 17 00:00:00 2001 From: Stephan Schroevers Date: Thu, 7 Sep 2023 20:58:30 +0200 Subject: [PATCH 2/2] Also update `UnnecessarilyVisible` --- .../com/google/errorprone/bugpatterns/UnnecessarilyVisible.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/src/main/java/com/google/errorprone/bugpatterns/UnnecessarilyVisible.java b/core/src/main/java/com/google/errorprone/bugpatterns/UnnecessarilyVisible.java index 77a60f328d7..f09be5fe033 100644 --- a/core/src/main/java/com/google/errorprone/bugpatterns/UnnecessarilyVisible.java +++ b/core/src/main/java/com/google/errorprone/bugpatterns/UnnecessarilyVisible.java @@ -56,6 +56,8 @@ public final class UnnecessarilyVisible extends BugChecker implements MethodTree VisitorState.memoize( s -> Stream.of( + "com.google.errorprone.refaster.annotation.AfterTemplate", + "com.google.errorprone.refaster.annotation.BeforeTemplate", "com.google.inject.Inject", "com.google.inject.Provides", "com.google.inject.multibindings.ProvidesIntoMap",