Skip to content

Commit 7d2ad18

Browse files
authored
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 <[email protected]>
1 parent 43a2504 commit 7d2ad18

File tree

4 files changed

+22
-15
lines changed

4 files changed

+22
-15
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ jobs:
127127
- name: Setup Gradle
128128
uses: ./.github/actions/setup-gradle
129129
with:
130-
java-version: 17
130+
java-version: 24
131131
gradle-cache-read-only: ${{ !inputs.is-trunk }}
132132
gradle-cache-write-only: ${{ inputs.is-trunk }}
133133
develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }}

build.gradle

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,6 @@ ext {
7272
"--add-opens=java.security.jgss/sun.security.krb5=ALL-UNNAMED"
7373
)
7474

75-
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_24)) {
76-
// Spotbugs is not compatible with Java 24+ until Spotbugs 4.9.4. Disable it until we can upgrade to that version.
77-
project.gradle.startParameter.excludedTaskNames.add("spotbugsMain")
78-
project.gradle.startParameter.excludedTaskNames.add("spotbugsTest")
79-
}
80-
8175
maxTestForks = project.hasProperty('maxParallelForks') ? maxParallelForks.toInteger() : Runtime.runtime.availableProcessors()
8276
maxScalacThreads = project.hasProperty('maxScalacThreads') ? maxScalacThreads.toInteger() :
8377
Math.min(Runtime.runtime.availableProcessors(), 8)

gradle/dependencies.gradle

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,7 @@ versions += [
123123
scoverage: "2.0.11",
124124
slf4j: "1.7.36",
125125
snappy: "1.1.10.7",
126-
// While Spotbugs 4.9.3 exists at the time of writing,
127-
// Spotbugs 4.9.1 is the latest version not affected by https://github.com/spotbugs/spotbugs/pull/3311,
128-
// which breaks the build, so we're sticking with that version until 4.9.4 is released.
129-
spotbugs: "4.9.1",
126+
spotbugs: "4.9.4",
130127
mockOAuth2Server: "2.2.1",
131128
zinc: "1.9.2",
132129
// When updating the zstd version, please do as well in docker/native/native-image-configs/resource-config.json

gradle/spotbugs-exclude.xml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ For a detailed description of spotbugs bug categories, see https://spotbugs.read
551551
</Match>
552552

553553
<Match>
554-
<!-- New warning type added when we upgraded from spotbugs 4.8.6 to 4.9.1.
554+
<!-- New warning type added when we upgraded from spotbugs 4.8.6 to 4.9.4.
555555
These are possibly real bugs, and have not been evaluated, they were just bulk excluded to unblock upgrading Spotbugs.
556556
-->
557557
<Or>
@@ -586,7 +586,7 @@ For a detailed description of spotbugs bug categories, see https://spotbugs.read
586586
</Match>
587587

588588
<Match>
589-
<!-- New warning type added when we upgraded from spotbugs 4.8.6 to 4.9.1.
589+
<!-- New warning type added when we upgraded from spotbugs 4.8.6 to 4.9.4.
590590
These are possibly real bugs, and have not been evaluated, they were just bulk excluded to unblock upgrading Spotbugs.
591591
-->
592592
<Or>
@@ -617,12 +617,16 @@ For a detailed description of spotbugs bug categories, see https://spotbugs.read
617617
<Class name="kafka.coordinator.transaction.TransactionStateManager"/>
618618
<Class name="kafka.log.LogManager"/>
619619
<Class name="kafka.server.ReplicaManager"/>
620+
<Class name="org.apache.kafka.streams.state.internals.AbstractDualSchemaRocksDBSegmentedBytesStore"/>
621+
<Class name="org.apache.kafka.streams.state.internals.AbstractRocksDBSegmentedBytesStore"/>
622+
<Class name="org.apache.kafka.streams.state.internals.InMemorySessionStore"/>
623+
<Class name="org.apache.kafka.streams.state.internals.InMemoryWindowStore"/>
620624
</Or>
621625
<Bug pattern="AT_NONATOMIC_64BIT_PRIMITIVE"/>
622626
</Match>
623627

624628
<Match>
625-
<!-- New warning type added when we upgraded from spotbugs 4.8.6 to 4.9.1.
629+
<!-- New warning type added when we upgraded from spotbugs 4.8.6 to 4.9.4.
626630
These are possibly real bugs, and have not been evaluated, they were just bulk excluded to unblock upgrading Spotbugs.
627631
-->
628632
<Or>
@@ -687,12 +691,13 @@ For a detailed description of spotbugs bug categories, see https://spotbugs.read
687691
<Class name="kafka.server.ReplicaManager"/>
688692
<Class name="org.apache.kafka.trogdor.coordinator.NodeManager$NodeHeartbeat"/>
689693
<Class name="org.apache.kafka.connect.runtime.distributed.DistributedHerder$RebalanceListener"/>
694+
<Class name="org.apache.kafka.streams.processor.internals.StreamThread"/>
690695
</Or>
691696
<Bug pattern="AT_STALE_THREAD_WRITE_OF_PRIMITIVE"/>
692697
</Match>
693698

694699
<Match>
695-
<!-- New warning type added when we upgraded from spotbugs 4.8.6 to 4.9.1.
700+
<!-- New warning type added when we upgraded from spotbugs 4.8.6 to 4.9.4.
696701
These are possibly real bugs, and have not been evaluated, they were just bulk excluded to unblock upgrading Spotbugs.
697702
-->
698703
<Or>
@@ -719,4 +724,15 @@ For a detailed description of spotbugs bug categories, see https://spotbugs.read
719724
<Bug pattern="HSM_HIDING_METHOD"/>
720725
</Match>
721726

727+
<Match>
728+
<!-- New warning type added when we upgraded from spotbugs 4.8.6 to 4.9.4.
729+
These are possibly real bugs, and have not been evaluated, they were just bulk excluded to unblock upgrading Spotbugs.
730+
-->
731+
<Or>
732+
<Class name="org.apache.kafka.common.security.ssl.SslFactory$SslEngineValidator"/>
733+
<Class name="org.apache.kafka.server.authorizer.Authorizer"/>
734+
</Or>
735+
<Bug pattern="SF_SWITCH_FALLTHROUGH"/>
736+
</Match>
737+
722738
</FindBugsFilter>

0 commit comments

Comments
 (0)