From 1790d7b540597e57b287b79d54bacf1a0ffbe165 Mon Sep 17 00:00:00 2001 From: Divyansh Vijayvergia Date: Fri, 24 Apr 2026 12:22:03 +0000 Subject: [PATCH 1/2] Bump google-java-format to 1.27.0 and fmt CI JDK to 17 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 --- .github/workflows/push.yml | 3 ++- pom.xml | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 990d885d5..3ecb424a3 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -30,7 +30,8 @@ jobs: - name: Setup build environment uses: ./.github/actions/setup-build-environment with: - java-version: 11 + # google-java-format 1.27.0 (pinned in pom.xml) requires JRE 17+ to run. + java-version: 17 - name: Check formatting run: mvn --errors spotless:check diff --git a/pom.xml b/pom.xml index eb82c70b8..bd663de55 100644 --- a/pom.xml +++ b/pom.xml @@ -84,11 +84,11 @@ - - 1.22.0 + + 1.27.0 From ccb543cb1777be13aecb5096cbe2a4684c00b733 Mon Sep 17 00:00:00 2001 From: Divyansh Vijayvergia Date: Thu, 30 Apr 2026 17:44:36 +0000 Subject: [PATCH 2/2] Add `make fmt-jdk17` and auto-fallback in `make fmt` 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 --- Makefile | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 811dd0577..32c24823c 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,16 @@ fmt: - mvn spotless:apply + @mvn spotless:apply || ( \ + echo ""; \ + echo "==> default JDK could not run google-java-format (likely < JDK 17). Retrying with JDK 17..."; \ + echo ""; \ + $(MAKE) fmt-jdk17 \ + ) + +# Same as `fmt` but runs under JDK 17 explicitly. Use this when your default +# JDK is older than 17 (e.g. JDK 11), since google-java-format 1.27.0 — pinned +# in pom.xml for JDK 25 generator support — requires JRE 17+ to load. +fmt-jdk17: + JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64 mvn spotless:apply test: mvn test