From 7100b99a69f098ff77b8e93f8ed3c1f2849448da Mon Sep 17 00:00:00 2001 From: Callum Rogers Date: Thu, 12 Jun 2025 17:11:18 +0100 Subject: [PATCH 1/4] Disable some more built in Google errorprones --- .../baseline/plugins/BaselineErrorProne.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) 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 216a1709b..2c95b1af6 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 @@ -97,7 +97,13 @@ private static void configureErrorProneOptions(ErrorProneOptions errorProneOptio "AndroidJdkLibsChecker", "AutoCloseableMustBeClosed", "CatchSpecificity", + // This might be worth re-evaluating later and auto-patching. But removing it for now to remove some + // auto-suppression noise. + "CatchingUnchecked", "CanIgnoreReturnValueSuggester", + // This might be worth re-evaluating later - but removing it for now to remove some + // auto-suppression noise. + "DifferentNameButSame", // https://github.com/google/error-prone/issues/4544 "DistinctVarargsChecker", // This does not allow underscore prefixed variables, which we use heavily. @@ -112,6 +118,22 @@ private static void configureErrorProneOptions(ErrorProneOptions errorProneOptio // We often use javadoc comments without javadoc parameter information. "NotJavadoc", "PreferImmutableStreamExCollections", + "PreferImmutableCollection", + // We prefer to use List<...> instead of ImmutableList<...>. This way we don't expose the + // underlying implementation to the user. + "PreferredInterfaceType", + // This is so common we're not going to enforce it. Personally, I don't think it matters too much + // for RuntimeExceptions, as they are not supposed to be caught + "ThrowSpecificExceptions", + // This check is low value - an extra final doesn't really hurt anyone. It's very spammy when + // auto-suppressed though. + "UnnecessaryFinal", + // This forces Foo.Builder -> Builder, even when you may want to use Foo.Builder, apart from + // some allowlist. Let's leave it up to dev's discretion. Most people don't like fully qualified + // types anyway. + "UnnecessaryFullyQualified", + // This one isn't even correct for eg Gradle, which needs to be public. + "UnnecessarilyVisible", "UnnecessaryTestMethodPrefix", "UnusedVariable", // Var seems low value. Forcing devs to add a dep for annotations is too much. From 69b624c2759bfb97c46dfeba8cc602f73c9443b8 Mon Sep 17 00:00:00 2001 From: Callum Rogers Date: Thu, 12 Jun 2025 17:13:51 +0100 Subject: [PATCH 2/4] goddamn ai --- .../java/com/palantir/baseline/plugins/BaselineErrorProne.java | 1 - 1 file changed, 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 2c95b1af6..e2bd6505f 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 @@ -118,7 +118,6 @@ private static void configureErrorProneOptions(ErrorProneOptions errorProneOptio // We often use javadoc comments without javadoc parameter information. "NotJavadoc", "PreferImmutableStreamExCollections", - "PreferImmutableCollection", // We prefer to use List<...> instead of ImmutableList<...>. This way we don't expose the // underlying implementation to the user. "PreferredInterfaceType", From 2982d7123564d9c948ed9e0d4e395357b94a879d Mon Sep 17 00:00:00 2001 From: svc-changelog Date: Thu, 12 Jun 2025 16:16:41 +0000 Subject: [PATCH 3/4] Add generated changelog entries --- changelog/@unreleased/pr-3124.v2.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 changelog/@unreleased/pr-3124.v2.yml diff --git a/changelog/@unreleased/pr-3124.v2.yml b/changelog/@unreleased/pr-3124.v2.yml new file mode 100644 index 000000000..4224007fa --- /dev/null +++ b/changelog/@unreleased/pr-3124.v2.yml @@ -0,0 +1,13 @@ +type: fix +fix: + description: |- + Disable some new low-value Google provided errorprone checks: + * `CatchingUnchecked` + * `DifferentNameButSame` + * `PreferredInterfaceType` + * `ThrowSpecificExceptions` + * `UnnecessaryFinal` + * `UnnecessaryFullyQualified` + * `UnnecessarilyVisible` + links: + - https://github.com/palantir/gradle-baseline/pull/3124 From b2f3eae62fd55fd8f7151735da7ba24e89f43ab5 Mon Sep 17 00:00:00 2001 From: Callum Rogers Date: Thu, 12 Jun 2025 17:52:23 +0100 Subject: [PATCH 4/4] ai :( --- .../java/com/palantir/baseline/plugins/BaselineErrorProne.java | 2 +- 1 file changed, 1 insertion(+), 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 e2bd6505f..c063d229b 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 @@ -130,7 +130,7 @@ private static void configureErrorProneOptions(ErrorProneOptions errorProneOptio // This forces Foo.Builder -> Builder, even when you may want to use Foo.Builder, apart from // some allowlist. Let's leave it up to dev's discretion. Most people don't like fully qualified // types anyway. - "UnnecessaryFullyQualified", + "UnnecessarilyFullyQualified", // This one isn't even correct for eg Gradle, which needs to be public. "UnnecessarilyVisible", "UnnecessaryTestMethodPrefix",