Skip to content

Commit 8dda05e

Browse files
committed
Run the value class tests on JDK 28 early access
JEP 401 was integrated into JDK 28 on 2026-07-31, so its early-access builds are the JDK with value classes, and Temurin's come through actions/setup-java as 28-ea. The leg replaces the jdk.java.net Valhalla build pinned two commits ago: that line, based on JDK 27, declares VALUE between NON_SEALED and FINAL in javax.lang.model.element.Modifier and so sorted `value final public` to `public value final`. Mainline declares VALUE last, after STRICTFP, and sorts it to `public final value`, the order upstream's tests expect; the tests expect it again.
1 parent 560bdbf commit 8dda05e

4 files changed

Lines changed: 15 additions & 35 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
# formatter parses with. The IntelliJ plugin's tests stay on the runtime of the IDE they start.
5151
# JDK 21 itself is `build`, the check the default branch requires.
5252
jdk:
53-
name: build (JDK ${{ matrix.jdk }}${{ matrix.valhalla && ', Valhalla EA' || '' }})
53+
name: build (JDK ${{ matrix.jdk }}${{ matrix.ea && '-ea' || '' }})
5454
runs-on: ubuntu-latest
5555
strategy:
5656
fail-fast: false
@@ -68,40 +68,25 @@ jobs:
6868
Gradle 9.7.1 does not run on Java 27 yet, and the Gradle plugin's tests run their TestKit builds on
6969
the test JVM, where they fail with "Unsupported class file major version 71". Those tests are left
7070
out until the wrapper's Gradle supports Java 27.
71-
# The JEP 401 early-access build from https://jdk.java.net/valhalla/, the one JDK with value classes
72-
# until they reach a release: the value class tests (#131) are skipped on every other JDK. No
73-
# setup-java distribution serves it, so the build is pinned here by URL and checksum from the
74-
# download page; bump both when a newer build appears there.
75-
- jdk: 27
76-
valhalla: https://download.java.net/java/early_access/valhalla/27/1/openjdk-27-jep401ea3+1-1_linux-x64_bin.tar.gz
77-
valhalla_sha256: b8bdd7b181c6a5ea2dd9959255e222cd9d9a9f42cca4f2400991b9b2ff7ffb7d
71+
# Value classes (JEP 401) are a preview feature of JDK 28, so until it is released the `value` modifier
72+
# tests (#131) run on its early-access builds and are skipped everywhere else.
73+
- jdk: 28
74+
ea: true
7875
gradle_args: -x :gradle-open-java-format:test
79-
gradle_args_reason: As for JDK 27, the release this build is based on.
76+
gradle_args_reason: As on JDK 27, the wrapper's Gradle does not run on Java 28 either.
8077
steps:
8178
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
8279
with:
8380
persist-credentials: false
8481

85-
- name: Download the Valhalla early-access JDK
86-
if: ${{ matrix.valhalla }}
87-
id: valhalla
88-
env:
89-
URL: ${{ matrix.valhalla }}
90-
SHA256: ${{ matrix.valhalla_sha256 }}
91-
run: |
92-
curl --fail --silent --show-error --location --output "$RUNNER_TEMP/valhalla.tar.gz" "$URL"
93-
echo "$SHA256 $RUNNER_TEMP/valhalla.tar.gz" | sha256sum --check
94-
echo "archive=$RUNNER_TEMP/valhalla.tar.gz" >> "$GITHUB_OUTPUT"
95-
96-
# No problem matcher in this job: `build` annotates the warnings. The Valhalla build is the archive
97-
# downloaded above: jdkfile is the distribution for a JDK that setup-java did not fetch itself.
82+
# No problem matcher in this job: `build` annotates the warnings. An `ea` leg takes the newest
83+
# early-access build of its version.
9884
- name: Install JDK ${{ matrix.jdk }} for the tests
9985
id: test-jdk
10086
uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
10187
with:
102-
distribution: ${{ matrix.valhalla && 'jdkfile' || 'temurin' }}
103-
jdk-file: ${{ steps.valhalla.outputs.archive }}
104-
java-version: ${{ matrix.jdk }}
88+
distribution: temurin
89+
java-version: ${{ matrix.jdk }}${{ matrix.ea && '-ea' || '' }}
10590
problem-matcher: false
10691

10792
# Installed last, so that it is the JAVA_HOME Gradle runs and compiles on.

‎README.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,9 @@ mise trust && mise install
138138
```
139139

140140
`-PjavaRuntime=25` runs the same tests on JDK 25, as CI's `jdk` jobs do for 25, 26 and 27, and for
141-
the Valhalla early-access build, the one JDK whose value classes the `value` modifier tests need.
142-
The code is compiled for Java 21 either way. Gradle has to find that JDK: installed with mise, or
143-
named with `-Porg.gradle.java.installations.paths=/path/to/jdk`.
141+
the early-access builds of 28, where value classes are a preview feature and the `value` modifier
142+
tests run. The code is compiled for Java 21 either way. Gradle has to find that JDK: installed with
143+
mise, or named with `-Porg.gradle.java.installations.paths=/path/to/jdk`.
144144

145145
Nothing inside the build downloads a JDK. `gradle.properties` turns toolchain auto-download off and
146146
reads the installations from `JDK21_HOME` and `GRAALVM_HOME`, so a missing JDK is an error you can

‎open-java-format/src/test/java/com/palantir/javaformat/java/FormatterTest.java‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -592,11 +592,8 @@ value final public class PointValueClass {
592592
593593
value public record PointValueRecord(int x, int y) {}
594594
""";
595-
// The orderer follows the Modifier enum, and the JEP 401 early-access builds declare VALUE between NON_SEALED
596-
// and FINAL. Upstream expects `final value`, the order of Valhalla's lworld branch, where VALUE comes last.
597-
// Re-check when CI moves to a newer build.
598595
String expected = """
599-
public value final class PointValueClass {
596+
public final value class PointValueClass {
600597
final int x;
601598
final int y;
602599

‎open-java-format/src/test/java/com/palantir/javaformat/java/ModifierOrdererTest.java‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,8 @@ void valueClass() throws FormatterException {
121121
Arrays.stream(Modifier.values())
122122
.anyMatch(modifier -> modifier.name().equals("VALUE")),
123123
"`value` is a modifier only on a JDK with Project Valhalla's value classes");
124-
// The JEP 401 early-access builds declare VALUE between NON_SEALED and FINAL; upstream expects `final value`,
125-
// the order of Valhalla's lworld branch, where VALUE comes last. Re-check when CI moves to a newer build.
126124
assertThat(ModifierOrderer.reorderModifiers("value final public").getText())
127-
.isEqualTo("public value final");
125+
.isEqualTo("public final value");
128126
}
129127

130128
@Test

0 commit comments

Comments
 (0)