Skip to content

Commit 2327e51

Browse files
authored
KAFKA-20182 Remove removeUnusedImports and upgrade spotless to 8.4.0 (#22025)
Follow-up to #22012. Removes removeUnusedImports because its engines (google-java-format, cleanthat) can non-deterministically throw InvocationTargetException under parallel execution (see diffplug/spotless#2850 for a similar report). Unused imports are still enforced by checkstyle (UnusedImports + RedundantImport). Also bumps Spotless from 8.3.0 to 8.4.0. Verified locally: - `./gradlew build -x test` passes (spotlessCheck + checkstyle + spotbugs + compile all green) - `./gradlew clean spotlessApply --rerun-tasks --no-build-cache` ran 700 times with 0 failures Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
1 parent 4acdac6 commit 2327e51

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

build.gradle

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ plugins {
4040
id "com.github.spotbugs" version '6.4.4' apply false
4141
id 'org.scoverage' version '8.1' apply false
4242
id 'com.gradleup.shadow' version '9.3.1' apply false
43-
id 'com.diffplug.spotless' version "8.3.0"
43+
id 'com.diffplug.spotless' version "8.4.0"
4444
}
4545

4646
ext {
@@ -871,14 +871,11 @@ subprojects {
871871
java {
872872
targetExclude('**/generated/**/*.java','**/generated-test/**/*.java')
873873
importOrder('kafka', 'org.apache.kafka', 'com', 'net', 'org', 'java', 'javax', '', '\\#')
874-
// The default engine (google-java-format) uses the JDK compiler's internal
875-
// parser (com.sun.tools.javac.*), which JPMS blocks without --add-exports.
876-
// Gradle 9.3+ / Spotless 8.x no longer pass those exports to the worker JVM,
877-
// so the default engine fails at runtime. The cleanthat engine uses the
878-
// JavaParser library instead, which ships its own Java parser and does not
879-
// rely on any JDK internal classes, so it works out of the box.
880-
// See KAFKA-20182.
881-
removeUnusedImports('cleanthat-javaparser-unnecessaryimport')
874+
// removeUnusedImports is intentionally omitted because its engines
875+
// (google-java-format, cleanthat) can non-deterministically throw
876+
// InvocationTargetException under parallel execution. Unused imports are
877+
// still enforced by checkstyle (UnusedImports + RedundantImport).
878+
// Re-enable once https://github.com/diffplug/spotless/issues/2850 is fixed.
882879
}
883880
}
884881

0 commit comments

Comments
 (0)