Skip to content

build: pin the Gradle daemon JVM to 21 - #84

Merged
jamesarich merged 1 commit into
mainfrom
chore/pin-gradle-daemon-jvm
Sep 17, 2026
Merged

jamesarich merged 1 commit into
mainfrom
chore/pin-gradle-daemon-jvm

Conversation

@jamesarich

Copy link
Copy Markdown
Collaborator

Summary

Adds gradle/gradle-daemon-jvm.properties with toolchainVersion=21, so the Gradle daemon runs on Java 21 whatever JDK the launcher or the CI runner offers. Fixes :detekt on the JDK 25 runners that #81 introduced, and unblocks #82.

Type of change

  • Infrastructure / CI / build

Related issue / discussion

Follows #81 (java-jdk v25). Unblocks #82. Supersedes #83, which reverted #81 instead — this is the better shape, because it fixes the class of problem rather than one instance.

detekt 1.23.8 invokes its analysis in-process on the Gradle daemon's JVM, and the embedded Kotlin compiler's shaded IntelliJ JavaVersion.parse rejects a feature version of 25:

Caused by: java.lang.IllegalArgumentException: 25.0.4.1
  at org.jetbrains.kotlin.com.intellij.util.lang.JavaVersion.parse(JavaVersion.java:307)
  at org.jetbrains.kotlin.com.intellij.util.lang.JavaVersion.current(JavaVersion.java:176)
  at org.jetbrains.kotlin.cli.jvm.modules.JavaVersionUtilsKt.isAtLeastJava9(javaVersionUtils.kt:11)
  at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.<init>(KotlinCoreEnvironment.kt:243)
  at io.github.detekt.parser.KotlinEnvironmentUtilsKt.createKotlinCoreEnvironment(KotlinEnvironmentUtils.kt:61)
  at io.gitlab.arturbosch.detekt.core.tooling.AnalysisFacade.runAnalysis

1.23.8 is the newest stable detekt, so there is nothing to bump to.

How was this verified?

Measured both ways on this machine, against a real JDK 25 requested explicitly, with --rerun-tasks --no-build-cache so nothing could be replayed:

./gradlew detekt --rerun-tasks --no-build-cache -Dorg.gradle.java.home=<JDK 25>
without this file FAILEDExecution failed for task ':detekt' / > 25.0.3
with this file BUILD SUCCESSFUL, 1 actionable task: 1 executed

Also confirmed jvmToolchain(21) was never the issue: :jvmMainClasses --rerun-tasks --no-build-cache with the daemon on JDK 25 still emits major-version 65 (Java 21) bytecode, per javap -v. #81 was a CI-runner change, not a published-bytecode change.

Why #81's CI did not catch this

:detekt was served FROM-CACHE on #81's PR run and on its merge-queue run — nothing detekt reads had changed, so the new runner JDK was never exercised. The first build that actually re-ran detekt under JDK 25 was the merge-queue run for #82, which failed. On this PR detekt will very likely be FROM-CACHE again for the same reason; #82's merge-queue run is the build that genuinely proves the fix, because the Kotlin bump invalidates detekt's inputs.

Affirmations

  • All commits are signed off (DCO).
  • I have read CONTRIBUTING.md.
  • No public API change.
  • No codec or wire-frame change.
  • ./gradlew build passes locally.

Notes for reviewers

  • No toolchainUrl.* download entries. ./gradlew updateDaemonJvm refuses to generate them here — Toolchain download repositories have not been configured — because this build deliberately carries no foojay resolver. Without them Gradle must detect a JDK 21 rather than download one; GitHub's runner images ship one, and CONTRIBUTING.md already requires JDK 21 locally. Adding the foojay resolver to settings.gradle.kts is the follow-up if that ever bites.
  • This brings kzstd in line with the org's other KMP repos. MQTTastic-Client-KMP, meshtastic-sdk and meshtastic-node-kmp already carry this file; kzstd, TAKPacket-SDK and gradle-flatpak-sources did not, and those last two run detekt 1.23.x too — they have the same latent break the moment they take a runner-JDK bump.

`:detekt` cannot run on JDK 25. detekt 1.23.8 invokes its analysis in-process on
the Gradle daemon's JVM, and the embedded Kotlin compiler's shaded
`com.intellij.util.lang.JavaVersion.parse` rejects a feature version of 25:

    Caused by: java.lang.IllegalArgumentException: 25.0.4.1
      at ...JavaVersion.parse(JavaVersion.java:307)
      at ...JavaVersion.current(JavaVersion.java:176)
      at ...JavaVersionUtilsKt.isAtLeastJava9(javaVersionUtils.kt:11)
      at ...KotlinCoreEnvironment.<init>(KotlinCoreEnvironment.kt:243)
      at io.gitlab.arturbosch.detekt.core...AnalysisFacade.runAnalysis

1.23.8 is the newest stable detekt, so there is no version to bump to. Pinning
the daemon is what the other KMP repos in the org already do —
MQTTastic-Client-KMP, meshtastic-sdk and meshtastic-node-kmp all carry this
file; kzstd, TAKPacket-SDK and gradle-flatpak-sources do not, and kzstd is the
one that just took a runner-JDK bump (#81).

The pin outranks an explicitly requested JDK: measured here with
`./gradlew detekt --rerun-tasks --no-build-cache -Dorg.gradle.java.home=<a real
JDK 25>`, which is RED without this file (`> 25.0.3`) and BUILD SUCCESSFUL with
it, detekt executed rather than served from cache. So it also inoculates the
repo against every future runner-JDK bump, not just this one.

No `toolchainUrl.*` download entries: generating them needs a toolchain
download repository, which this build deliberately does not configure.
CI runners and `CONTRIBUTING.md` both already provide a JDK 21 to detect.

`jvmToolchain(21)` was never affected — compiling with the daemon on JDK 25
still emitted major-version 65 bytecode.

Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Sep 17, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 11 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 2916dc61-5f9e-44d7-9b6c-c834bb33e36d

📥 Commits

Reviewing files that changed from the base of the PR and between 54ccef4 and a2687be.

📒 Files selected for processing (1)
  • gradle/gradle-daemon-jvm.properties

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@jamesarich
jamesarich added this pull request to the merge queue Sep 17, 2026
Merged via the queue into main with commit 2e97c3b Sep 17, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant