From 36798f340ab2451c0ec2567f65a946d5646a11e3 Mon Sep 17 00:00:00 2001 From: Raymond Huffman Date: Fri, 22 Nov 2024 11:00:40 -0500 Subject: [PATCH 1/4] promote PreferCommonAnnotations to WARNING --- .../palantir/baseline/errorprone/PreferCommonAnnotations.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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..3d26266e8 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 @@ -39,7 +39,7 @@ @AutoService(BugChecker.class) @BugPattern( summary = "Prefer the common version of annotations over other copies.", - severity = SeverityLevel.SUGGESTION) + severity = SeverityLevel.WARNING) public final class PreferCommonAnnotations extends BugChecker implements ImportTreeMatcher { /** ClassName -> preferred import. */ From 1e9f51e2a1f0d0759a19c4af935869b6b6c981ca Mon Sep 17 00:00:00 2001 From: Raymond Huffman Date: Fri, 22 Nov 2024 11:14:27 -0500 Subject: [PATCH 2/4] spotlessApply --- .../palantir/baseline/errorprone/PreferCommonAnnotations.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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 3d26266e8..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.WARNING) +@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. */ From 10332ac45ed51cf3246abef3a1baf4e3501f7d57 Mon Sep 17 00:00:00 2001 From: svc-changelog Date: Fri, 22 Nov 2024 16:14:58 +0000 Subject: [PATCH 3/4] Add generated changelog entries --- changelog/@unreleased/pr-2962.v2.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelog/@unreleased/pr-2962.v2.yml 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 From 39132bd2f63fbe4799c682d6fcf978bac61aff5e Mon Sep 17 00:00:00 2001 From: Raymond Huffman Date: Fri, 22 Nov 2024 11:24:15 -0500 Subject: [PATCH 4/4] only apply check if guava exists --- .../com/palantir/baseline/plugins/BaselineErrorProne.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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"); }); }); }