Allow building with a Java 21 toolchain while targeting Java 17 #532
All Vouch review confidence checks passed
Residual risk 0.29 = Change Risk (0.52) × (1 − Review Confidence (0.45)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 445 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.365
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #532"
general
weight: 0.35
NicoPiel
Allow building with a Java 21 toolchain while targeting Java 17
Branch:
tony:build/java21-toolchain→mainSummary
This PR makes it possible to compile and test with a newer JDK while still shipping Java 17 bytecode and staying within the Java 17 API. The default build is unchanged: it still uses a Java 17 toolchain.
To make that the default on one machine, add
javaToolchain=21to~/.gradle/gradle.properties.Java 21 works with the current Gradle (8.14) and test libraries. Java 25 isn't covered here because it needs Gradle 9.1+ and a newer Byte Buddy for Mockito.
The PR has three commits:
1. Upgrade JaCoCo to 0.8.15. JaCoCo 0.8.8 can't read class files newer than Java 18. On JDK 21 it logs a stack trace for each JDK class it fails to instrument, such as
CLDRLocaleDataMetaInfo. 0.8.15 officially supports up to Java 26 and has no API changes since 0.8.8. Its ASM 9.10.1 (replacing 9.2) is only on JaCoCo's own classpath and doesn't change the ASM we ship.gradle/verification-metadata.xmlwas regenerated with a cold cache, and the entries for the old versions were removed.2. Compile server tests without JDK internal exports. javac doesn't allow
--add-exportsof system modules together with--release.KeyEncryptorTestonly importedcom.sun.crypto.provider.SunJCEto get its class name, which the encryption settings take as a string. It now uses the name as a constant. The other exported packages only appeared in string literals, so thecompileTestJavablock inserver/build.gradleis removed.3. Allow building with a newer JDK while targeting Java 17. All
JavaCompiletasks now useoptions.release = 17, so the output targets Java 17 whichever JDK compiles it. The toolchain defaults to the release version and can be overridden with-PjavaToolchain. The tests run on the same JDK.userApiJavadocnow runs the toolchain'sjavadocinstead of the one from the JDK running Gradle, and the javadoc version is now a task input, so switching toolchains regenerates the docs. CONTRIBUTING.md describes the new option.Closes #215.
Testing
<details>
<summary>Claude checked</summary>
./gradlew clean build -Pcoverage=true -PdisableSigning=truepassed before each commit. At the tip it passes with both the 17 and 21 toolchains, and all 768 tests pass.- Every class file from the 21 build is major version 61 (Java 17).
- Of the 3,640 classes, 1,487 are byte-identical. The 6,228 vocab classes are also byte-identical.
- 2,118 classes differ only in metadata from the newer javac: constant pool order,
MethodParametersattributes for the mandated and synthetic parameters of inner class constructors, andargNnames in theLocalVariableTableof anonymous class constructors.- In 25 classes,
Objectmethods (toString,equals,getClass) called on an interface type are emitted asinvokeinterfaceon the interface instead ofinvokevirtualonObject. The JVM resolves both to the same method.- In 8 classes, a switch on an enum inside that enum's own class uses
ordinal()directly instead of a$SwitchMap. This drops two synthetic classes (MetaDataColumnType$1andContextType$1) and three switch map fields from other synthetic classes.</details>
---
🤖 Drafted with Claude Code