build: Add Java 25 build compatibility#232
Merged
Merged
Conversation
Upgrade the build toolchain so the project compiles cleanly under both
Java 21 (CI) and Java 25 (local default JDK), in preparation for the
eventual Java 25 jump after Besu and Teku move.
* Gradle wrapper 8.8 -> 9.5.1 (minimum for JDK 25)
* Spotless 6.25.0 -> 8.4.0, Google Java Format 1.17.0 -> 1.35.0
(1.17 crashed on JDK 25 javac internals)
* spring dependency-management 1.1.5 -> 1.1.7 (1.1.5 broken on Gradle 9)
* Move sourceCompatibility/targetCompatibility into a java { toolchain }
block; top-level form removed in Gradle 9
* Add explicit testRuntimeOnly junit-platform-launcher (Gradle 9 stopped
auto-loading it)
* Replace the unmaintained hierynomus.license plugin (broken on Gradle 9)
with Spotless licenseHeaderFile for header enforcement and
jk1.dependency-license-report 3.1.2 for the third-party license audit
* gradle.properties: add --enable-native-access=ALL-UNNAMED to silence
JEP-472 restricted-method warnings on JDK 24+
* Fix two Gradle 10-deprecated DSL lines (groovy_space_assignment_syntax)
* Spotless normalizes the blank line between SPDX header and package on
62 source files that previously missed it
lucassaldanha
approved these changes
May 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Description
Upgrade the build toolchain so the project compiles cleanly under both Java 21 (CI) and Java 25 (local default JDK), in preparation for the eventual Java 25 jump after Besu and Teku move. No source-level Java version bump — produced bytecode remains classfile 65 (Java 21).
Build infrastructure changes
Log$DeferredDiagnosticHandler.getDiagnostics()signature change)sourceCompatibility/targetCompatibilityjava { toolchain { languageVersion = 21 } }testRuntimeOnly junit-platform-launcherdownloadLicensesbroken on Gradle 9licenseHeaderFiledownloadLicenses/ customcheckLicensescom.github.jk1.dependency-license-report3.1.2gradle/allowed-licenses.jsonandgradle/license-normalizer-bundle.json. Verified by temporarily adding an LGPL dep —checkLicenserejected it correctly.org.gradle.jvmargs--enable-native-access=ALL-UNNAMEDAlso fixed two Gradle 10-deprecated DSL lines:
maven { url = ... }andgroupId = ...(groovy_space_assignment_syntax).Source changes
Spotless's
licenseHeaderFilenormalizes the blank line between the SPDX header andpackageon 62 source files that previously missed it. Pure whitespace, no logic changes.CI
CI continues to build on Java 21 only.
./gradlew buildtask graph still includes:checkLicense(wired viacheck.dependsOn 'checkLicense'), so the license safety net runs on every PR.Test plan
./gradlew buildclean on JDK 25 + Gradle 9.5.1 — green, no warnings, bytecode classfile 65./gradlew buildclean on JDK 21 + Gradle 9.5.1 (toolchain provisioned) — green apart from a known pre-existing flakeDiscoveryIntegrationTest.shouldRecoverAfterErrorWhileDecodingInboundMessage(unrelated; reproduces onmastertoo)./gradlew checkLicensecorrectly rejects an unapproved license — tested by temporarily addingorg.jfree:jfreechart:1.5.4(LGPL-2.1); build failed withGNU LESSER GENERAL PUBLIC LICENSE, Version 3 is not on the allowed list--warning-mode=all)Fixed Issue(s)
Note
Medium Risk
Moderate risk because it upgrades the Gradle wrapper to 9.5.1 and replaces the dependency license-check mechanism, which can change CI/build behavior and potentially fail builds due to stricter license normalization/allowlisting.
Overview
Enables building on newer JDKs by upgrading the Gradle wrapper to
9.5.1, moving Java versioning to ajava { toolchain { languageVersion = 21 } }configuration, adding--enable-native-access=ALL-UNNAMEDto Gradle JVM args, and explicitly addingjunit-platform-launcherat test runtime.Replaces the old
hierynomus.license/customcheckLicensesflow withcom.github.jk1.dependency-license-reportand a new allowlist+normalization setup (gradle/allowed-licenses.json,gradle/license-normalizer-bundle.json), wiringcheckto depend oncheckLicense.Updates formatting/header enforcement by upgrading Spotless and Google Java Format, shifting license header insertion to Spotless (
gradle/java.license), and applies whitespace-only header normalization across many Java sources; regeneratesgradlew/gradlew.bataccordingly.Reviewed by Cursor Bugbot for commit 6c18606. Bugbot is set up for automated code reviews on this repo. Configure here.