diff --git a/baseline-error-prone/src/main/java/com/palantir/baseline/errorprone/PreferCommonAnnotations.java b/baseline-error-prone/src/main/java/com/palantir/baseline/errorprone/PreferCommonAnnotations.java index ac520f29e..e38d80ec5 100644 --- a/baseline-error-prone/src/main/java/com/palantir/baseline/errorprone/PreferCommonAnnotations.java +++ b/baseline-error-prone/src/main/java/com/palantir/baseline/errorprone/PreferCommonAnnotations.java @@ -37,9 +37,7 @@ * - Guava's version of {@code @VisibleForTesting} over other copies. */ @AutoService(BugChecker.class) -@BugPattern( - summary = "Prefer the common version of annotations over other copies.", - severity = SeverityLevel.SUGGESTION) +@BugPattern(summary = "Prefer the common version of annotations over other copies.", severity = SeverityLevel.WARNING) public final class PreferCommonAnnotations extends BugChecker implements ImportTreeMatcher { /** ClassName -> preferred import. */ diff --git a/changelog/@unreleased/pr-2962.v2.yml b/changelog/@unreleased/pr-2962.v2.yml new file mode 100644 index 000000000..094f4b94b --- /dev/null +++ b/changelog/@unreleased/pr-2962.v2.yml @@ -0,0 +1,5 @@ +type: improvement +improvement: + description: promote PreferCommonAnnotations to WARNING + links: + - https://github.com/palantir/gradle-baseline/pull/2962 diff --git a/gradle-baseline-java/src/main/java/com/palantir/baseline/plugins/BaselineErrorProne.java b/gradle-baseline-java/src/main/java/com/palantir/baseline/plugins/BaselineErrorProne.java index 06e233fc7..62e0d68c8 100644 --- a/gradle-baseline-java/src/main/java/com/palantir/baseline/plugins/BaselineErrorProne.java +++ b/gradle-baseline-java/src/main/java/com/palantir/baseline/plugins/BaselineErrorProne.java @@ -61,7 +61,9 @@ private static void applyToJavaProject(Project project) { "PreferSafeLoggingPreconditions", "PreferSafeLoggableExceptions"), new ConditionalPatchCheck( - new IfModuleIsUsed("com.palantir.safe-logging", "logger"), "PreferSafeLogger")); + new IfModuleIsUsed("com.palantir.safe-logging", "logger"), "PreferSafeLogger"), + new ConditionalPatchCheck( + new IfModuleIsUsed("com.google.guava", "guava"), "PreferCommonAnnotations")); suppressibleErrorProneExtension.configureEachErrorProneOptions(BaselineErrorProne::configureErrorProneOptions); @@ -76,6 +78,7 @@ private static void applyToJavaProject(Project project) { errorProneOptions.disable("Slf4jConstantLogMessage"); errorProneOptions.disable("Slf4jLogsafeArgs"); errorProneOptions.disable("InjectOnConstructorOfAbstractClass"); + errorProneOptions.disable("PreferCommonAnnotations"); }); }); @@ -85,6 +88,7 @@ private static void applyToJavaProject(Project project) { errorProneOptions.disable("PreferSafeLoggableExceptions"); errorProneOptions.disable("PreferSafeLoggingPreconditions"); errorProneOptions.disable("StrictUnusedVariable"); + errorProneOptions.disable("PreferCommonAnnotations"); }); }); }