Open l0rinc opened 4 years ago
One quick note: sort order is a combination of multiple things, with different precedence. Highest precedence is for explicit order information (@JsonPropertyOrder( .... )
, @JsonProperty(index = ...)
); followed by "alphabetic" and "creator-bound properties first" general ordering info. I think ordering of creator-bound properties has higher precedence than more general alphabetic: but this should be documented better.
And for 3.0 it might be reasonable to reconsider logic, as well; the only reason for trying to sort creator properties first is that this is typically good for deserialization (reduces need for buffering).
I'll tag this as 3.x although if I have time I'd like to verify current processing to make sure I understand how it works first, before considering possible changes.
Given the following class:
The following
Spock
test fails:fails, since it's serialized to the keys
b
,a1
,a2
(uncommenting the first param, i.e.@JsonCreator public Child2(Object a1, Object b /*, Object a2*/) {}
would returna1
,b
,a2
).While this may be a relatively stable solution (not even sure about that, since apparently constructor changes can affect the order), it's definitely not alphabetic.