-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
@JsonProperty in @JsonCreator is conflicting with POJOs getters/attributes @JsonProperty - used to work with 1.9.11 #541
Comments
I don't think example above is complete: it won't reproduce the reported issue. Would it be possible to include more complete example to show what is actually happening? Exception suggests that there is an ambiguity in resolving what is the actual name to use, and that there are multiple explicit annotations giving conflicting names to things that are linked together be implicit names. |
Full executable repro :)
Executing the above code will give me the following exception:
|
Thanks! I will have to think about this a bit, to figure out whether this works as expected, or if it is a bug. The main question here is whether implicit name of 'str' creator argument is known; it appears it might be, because that's what is indicates as ambiguous (creator parameter "renamed" as 'str'; getter-induced property renamed as "s"). But then again, unless field is detected, things should be fine, because all accessors are explicitly renamed, and no ambiguity should exist. So I guess it looks like this could be considered a bug. One last thing: is this with 2.4.2? I am asking since there have been a few fixes since 2.3. |
Yes, this is version 2.4.2. The feature is basically meant to reformat your json, likely to condense the keys. What's annoying is that it used to work with 1.9.11. And this is a totally blocking issue for me. Impossible to upgrade. |
Yes, I think the visibility (or rather, lack thereof) of field |
I'm confused. What is the milestone for this? 2.4.3 or 2.5? |
It should be included in 2.4.3, as per release notes. Are there failing unit tests to show what is not working? |
I tried to upgrade to 2.4.3 yesterday and i still had some UT failing around that 'strange' @JsonCreator... |
Repro:
This works just fine with jackson 1.9.11
And this is the exception i get with jackson 2:
|
For me your test case actually passes for 2.4 branch (and master as well). I don't know if there's something in 2.4.4 that 2.4.3 is missing; or could it be that somehow you are running tests against an earlier version? |
I used the jar which is maven central repository, version 2.4.3. It didn't work with this one. |
Define two ObjectMappers, to Serialize and Deserialize
|
Note: See my second post below for the actual problem and repro.
Example of POJO:
and this doesn't help:
Even disabling DEFAULT_VIEW_INCLUSION doesn't help.
Give an exception like:
java.lang.IllegalStateException: Conflicting/ambiguous property name definitions (implicit name 'rewards'): found multiple explicit names: [s, str], but also implicit accessor: [method Foo#getStr(0 params)][visible=true,ignore=false,explicitName=false]
The text was updated successfully, but these errors were encountered: