-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Preserve order of @JsonAnySetter creator property arguments
#5352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 2.x
Are you sure you want to change the base?
Conversation
|
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. |
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.