Repository navigation
Read a field's constant name through .name, declare FormatStyle as an enum - #22
Merged
Merged
Conversation
… 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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).