From 7d2ad185206cd4c7089fceb07f9a3f2c016f38d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stig=20D=C3=B8ssing?= Date: Sun, 10 Aug 2025 17:38:15 +0200 Subject: [PATCH] KAFKA-19580 Upgrade to spotbugs 4.9.4 (#20333) Use Java 24 for the spotbugs checks, now that Spotbugs works on Java 24. Added some more warning exclusions for warnings that are new to 4.9.4. Reviewers: Chia-Ping Tsai --- .github/workflows/build.yml | 2 +- build.gradle | 6 ------ gradle/dependencies.gradle | 5 +---- gradle/spotbugs-exclude.xml | 24 ++++++++++++++++++++---- 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cb2a701fe58..5137f8bf372 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -127,7 +127,7 @@ jobs: - name: Setup Gradle uses: ./.github/actions/setup-gradle with: - java-version: 17 + java-version: 24 gradle-cache-read-only: ${{ !inputs.is-trunk }} gradle-cache-write-only: ${{ inputs.is-trunk }} develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} diff --git a/build.gradle b/build.gradle index 6dbe95e5611..2b4f1294e9c 100644 --- a/build.gradle +++ b/build.gradle @@ -72,12 +72,6 @@ ext { "--add-opens=java.security.jgss/sun.security.krb5=ALL-UNNAMED" ) - if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_24)) { - // Spotbugs is not compatible with Java 24+ until Spotbugs 4.9.4. Disable it until we can upgrade to that version. - project.gradle.startParameter.excludedTaskNames.add("spotbugsMain") - project.gradle.startParameter.excludedTaskNames.add("spotbugsTest") - } - maxTestForks = project.hasProperty('maxParallelForks') ? maxParallelForks.toInteger() : Runtime.runtime.availableProcessors() maxScalacThreads = project.hasProperty('maxScalacThreads') ? maxScalacThreads.toInteger() : Math.min(Runtime.runtime.availableProcessors(), 8) diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle index d1f14922d5a..bd957d7f8a7 100644 --- a/gradle/dependencies.gradle +++ b/gradle/dependencies.gradle @@ -123,10 +123,7 @@ versions += [ scoverage: "2.0.11", slf4j: "1.7.36", snappy: "1.1.10.7", - // While Spotbugs 4.9.3 exists at the time of writing, - // Spotbugs 4.9.1 is the latest version not affected by https://github.com/spotbugs/spotbugs/pull/3311, - // which breaks the build, so we're sticking with that version until 4.9.4 is released. - spotbugs: "4.9.1", + spotbugs: "4.9.4", mockOAuth2Server: "2.2.1", zinc: "1.9.2", // When updating the zstd version, please do as well in docker/native/native-image-configs/resource-config.json diff --git a/gradle/spotbugs-exclude.xml b/gradle/spotbugs-exclude.xml index 550432601b8..22a08ebd051 100644 --- a/gradle/spotbugs-exclude.xml +++ b/gradle/spotbugs-exclude.xml @@ -551,7 +551,7 @@ For a detailed description of spotbugs bug categories, see https://spotbugs.read - @@ -586,7 +586,7 @@ For a detailed description of spotbugs bug categories, see https://spotbugs.read - @@ -617,12 +617,16 @@ For a detailed description of spotbugs bug categories, see https://spotbugs.read + + + + - @@ -687,12 +691,13 @@ For a detailed description of spotbugs bug categories, see https://spotbugs.read + - @@ -719,4 +724,15 @@ For a detailed description of spotbugs bug categories, see https://spotbugs.read + + + + + + + + +