Skip to content

Read a field's constant name through .name, declare FormatStyle as an enum - #22

Merged
yogthos merged 1 commit into
mainfrom
fix/enum-name-not-str
Oct 26, 2026
Merged

yogthos merged 1 commit into
mainfrom
fix/enum-name-not-str

Conversation

@yogthos

@yogthos yogthos commented Oct 26, 2026

Copy link
Copy Markdown
Member

appendFraction read a ChronoField's name with str. On the JDK that is the display name (NanoOfSecond), so once jolt's str is JDK-faithful the builder throws unsupported field, which is what broke malli's time tests. It reads .name now; a test runs the builder with the field's str answering the display name.

FormatStyle is declared through jolt.host/register-enum! (JDK order, :enum? true), so values/valueOf/ordinal/compareTo/EnumSet/print match the JDK. On a jolt without register-enum! it falls back to plain statics, and the enum assertions are skipped there.

The ChronoUnit str test expected DAYS; the JDK and jolt main print Days. It now checks str agrees with toString.

Passes on jolt main (119 tests, 1161 assertions) and on the v0.8.23 release (1146).

… enum

On the JDK a ChronoField's toString is its display name (NanoOfSecond), so
appendFraction's str of the field stops matching once jolt's str is
JDK-faithful; that is what kept malli's time tests from loading. It reads
.name now.

FormatStyle goes through jolt.host/register-enum! in JDK order, so values,
valueOf, ordinal, compareTo, EnumSet and the #object print form behave as on
the JDK. A jolt without register-enum! still gets the plain constants.

The ChronoUnit str assertion expected the constant name; the JDK prints
Days, which jolt main now does too.
@yogthos
yogthos merged commit 28d55d6 into main Oct 26, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant