Bump google-java-format to 1.27.0 and fmt CI JDK to 17#778
Merged
Divyansh-db merged 3 commits intomainfrom Apr 30, 2026
Merged
Conversation
Follow-up to #777. Pinning GJF to 1.22.0 did not fix the JDK 25 generator crash because 1.22.0 still calls the old Queue-returning Log$DeferredDiagnosticHandler.getDiagnostics() signature that JDK 23+ removed. GJF 1.27.0 is the first release with the DeferredDiagnosticHandler compatibility fix, but it requires JRE 17+ to run. Bump the fmt CI job's java-version from 11 to 17 to match. The unit-tests matrix (JDK 8/11/17/20), release-build-check (JDK 8) and check-lock (JDK 11) are unaffected - none invoke spotless. Compiled bytecode target remains Java 8. Verified locally: - JDK 17: spotless:check passes - JDK 11: UnsupportedClassVersionError (intentional floor, class file v61.0) - JDK 25: scripts/mvn-spotless-apply.sh returns BUILD SUCCESS Co-authored-by: Isaac
Since pom.xml now pins google-java-format 1.27.0 (requires JRE 17+ to load), running `make fmt` on a default JDK older than 17 fails with UnsupportedClassVersionError. Add a `fmt-jdk17` target that explicitly points JAVA_HOME at /usr/lib/jvm/java-17-openjdk-amd64, and have `fmt` fall back to it automatically when the default JDK can't run the formatter. Behavior: - Default JDK >= 17: `make fmt` works as before, fallback never runs. - Default JDK < 17: first attempt fails loudly (so genuine non-JDK errors aren't hidden), then transparently retries via fmt-jdk17. - `make fmt-jdk17` is also usable directly. Co-authored-by: Isaac
Contributor
|
If integration tests don't run automatically, an authorized user can run them manually by following the instructions below: Trigger: Inputs:
Checks will be approved automatically on success. |
parthban-db
approved these changes
Apr 30, 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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Two-part fix that gets
mvn spotless:applyworking on the JDK 25 code-generator environment and keeps it ergonomic for contributors whose default JDK is still 11.1. Upgrade google-java-format and the fmt CI JDK
Follow-up to #777. That PR pinned GJF to 1.22.0 under the assumption it had the JDK 25 fix — it doesn't. GJF 1.22.0 still calls the old
Queue-returningLog$DeferredDiagnosticHandler.getDiagnostics()signature that OpenJDK removed in JDK 23+, so the code generator (JDK 25) continued crashing with the sameNoSuchMethodError.pom.xml— first release with theDeferredDiagnosticHandlerAPI-change fix (Google's commit96f114c, shipped 2025-05-06)..github/workflows/push.yml— GJF 1.25.0+ requires JRE 17 to run, so any version that supports JDK 25 forces a JDK floor bump for the one job that invokes spotless. No GJF version supports both JRE 11 and JDK 25.2. Local-dev ergonomics
Because GJF 1.27.0 needs JRE 17 to load,
mvn spotless:applyon a JDK 11 default crashes withUnsupportedClassVersionError. To keepmake fmtworking transparently for contributors still on JDK 11:make fmt-jdk17— new target, runsJAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64 mvn spotless:apply.make fmt— now falls back tofmt-jdk17automatically if the default-JDK attempt fails. The first attempt still runs visibly (so a genuine non-JDK error wouldn't be hidden), then a clear==> Retrying with JDK 17...message before the fallback.Contributors on JDK 17+ as their default see no behavioral change. Contributors on JDK 11 don't have to learn the new JDK pinning incantation —
make fmtjust works.Scope of the JDK bump
Only the
fmtjob moves. The rest of CI is untouched:unit-testsmatrix (JDK 8/11/17/20 runningmvn test): unaffected. Spotless has no<execution>binding, somvn testnever loads GJF.release-build-check.yml/package.yml(JDK 8): unaffected, same reason.check-lockjob (JDK 11): unaffected.maven-compiler-plugin.Test plan
Verified locally against all three JDKs available on the dev machine:
JAVA_HOME=.../java-17-openjdk-amd64 mvn spotless:check→BUILD SUCCESSUnsupportedClassVersionError: ... class file version 61.0, this version of the Java Runtime only recognizes class file versions up to 55.0. Intentional floor; no CI job invokes spotless under JDK 11.JAVA_HOME=.../temurin-25-jdk-amd64 bash scripts/mvn-spotless-apply.sh→BUILD SUCCESS(~13s). End-to-end reproduction of the generator's environment.make fmton JDK 11 — first attempt fails as expected, fallback message appears, then JDK 17 path runs and succeeds. Net result:BUILD SUCCESS.make fmt-jdk17directly —BUILD SUCCESSin ~14s on a default-JDK-11 shell.genkit update-sdkend-to-end on JDK 11 — succeeds (1325 tests, 0 failures). The local generator workflow is not blocked.git diff --statafter running spotless:apply on a clean tree shows no source-file reformats required by GJF 1.27.0 — diff is just config edits.fmt(now JDK 17), allunit-testsmatrix rows,release-build-check,check-lockall green.NO_CHANGELOG=true