Skip to content

Commit 560bdbf

Browse files
committed
Expect the modifier order of the pinned Valhalla build
The first run of the Valhalla leg sorted `value final public` to `public value final`: the JEP 401 early-access builds declare VALUE between NON_SEALED and FINAL in javax.lang.model.element.Modifier, whose order ModifierOrderer follows. Upstream expects `final value`, the order of Valhalla's lworld branch, where VALUE comes last. The tests now expect what the pinned build does; re-check them when CI moves to a newer build.
1 parent ead0aee commit 560bdbf

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,8 +592,11 @@ 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.
595598
String expected = """
596-
public final value class PointValueClass {
599+
public value final class PointValueClass {
597600
final int x;
598601
final int y;
599602

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,10 @@ 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.
124126
assertThat(ModifierOrderer.reorderModifiers("value final public").getText())
125-
.isEqualTo("public final value");
127+
.isEqualTo("public value final");
126128
}
127129

128130
@Test

0 commit comments

Comments
 (0)