You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Recognize the value modifier (Project Valhalla value classes and records) #131
Upstream landed support for the contextual modifier value on classes and records, in the AST visitor and in the modifier orderer, so value classes format correctly on JDKs that accept them. The first attempt (google-java-format#1479, 5f7a569) was rolled back the same day (google-java-format#1481, because of an internal Google test failure, not a design problem) and re-landed the next day (1959806, +92/-20 lines instead of +52/-2, same four files), so the commit that stuck is the one to read, not the first.
Why it matters: our modifier lists know sealed and non-sealed but not value, so on a Valhalla-enabled JDK the modifier would likely be treated as an ordinary identifier, mis-ordered, or break the line oddly. This is new-syntax support, relevant once we run tests on JDK 27 early-access builds (see our #29, #30).
Affected files in our repo:
open-java-format/src/main/java/com/palantir/javaformat/java/JavaInputAstVisitor.java (nextIsModifier, modifier handling for class and record declarations)
open-java-format/src/main/java/com/palantir/javaformat/java/ModifierOrderer.java (the token-to-modifier mapping)
Suggested action: port. Add value to both places, with tests for value class and value record that are skipped when the running JDK cannot parse them. Check that a field or variable named value is not affected.
Filed from an upstream-watch ticket after manual review.
Activity