Preserve order of @JsonAnySetter creator property arguments#5352
Preserve order of @JsonAnySetter creator property arguments#5352eranl wants to merge 8 commits intoFasterXML:2.xfrom
@JsonAnySetter creator property arguments#5352Conversation
|
I think we'd first need an issue explaining what is the problem to fix. |
|
Ok, use of But adding overhead of reordering for every use is not good -- many users would get penalized despite not caring about ordering. So if we can figure out how to insert values in order, +1. @JooHyukKim knows this area pretty well and can probably help. |
You mean the recursion? Is that measurable? |
No I mean reordering in general; should be possible to just retain insert order without essentially ordering twice. |
|
The only change I made there was replacing iteration with recursion. |
Hmh. Ok, I probably need to re-read PR. But yes, recursion on its own can also be problematic wrt security aspects (stack overflow) so ideally not usad with linear data structures. |
|
Ok yes, recursion to re-order, since it's effectively linked list. Hmmh. |
|
Sorry late reply.
|
|
I considered replacing the linked list with some |
|
I'm not happy with recursion due to possible stack exhaustion. But adding an extra data structure not great either. I think we need to have this as opt-in ( |
I'm proposing a replacement data structure, not an extra one. |
|
One other note: while retaining order sounds like an improvement, it also has some backwards-compatibility aspects so I think that actual change should probably go against So, if -- for example, But +1 for improved data structure, fix against |
|
I guess that makes sense, but it requires that I upgrade to v3 first, so it'll take a while... |
Understood. |
|
I think change would need to be for |
@eranl are u still able to pick up where you left off? |
|
I will be able to at some point, but not soon. |
|
Alt. implementation via #5766, closing this pr. |
Make
@JsonAnySettercreator properties behave similarly to non-creator ones, using aLinkedHashMap.Since the arguments are stored in a reverse-order singly-linked list, I used recursion to restore the original order. Any better way to do it?
Fixes #5353.