-
Notifications
You must be signed in to change notification settings - Fork 175
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 field names not respected in superclass fields #151
Comments
and the usual question to help @apatrida: is this with 2.9.5? |
@marshallpierce it looks like it works if you use |
As @arekolek says, target the annotation to the getter (@cowtowncoder another one where the annotations end up on the wrong thing since Kotlin has more annotation targets than Java) |
not fixed in 2.9.6 @apatrida why has this issue been closed? are you not going to fix it? |
@or-dvir
works fine |
@arekolek i am getting an error. the this is my code
|
The error tells you exactly what you did wrong, you put a @ after colon
instead of just the annotation identifier.
https://kotlinlang.org/docs/reference/annotations.html#annotation-use-site-targets
|
face palm |
Still fixed :-D |
ok guys... this is NOT a proper solution, but a workaround which can cause problems (admittedly, due to human error). story time:i got stuck on a problem for a few days now where when i deserialized an object (not even using jackson, im talking about a simple the point of this story is that this solu.... i mean workaround, is an unnecessary extra step which could very easily be forgotten - and if indeed forgotten, could cause trouble. for the creators of this library (or anyone willing to dive into this and submit a pull request), PLEASE look into this and remove this unnecessary extra step |
I agree the proposed solution is not intuitive. Why would the |
I would like to have a fix as well |
I am using java and jackson version 2.12.4 and still encounter this same problem. |
@nickmafra @or-dvir A good first step towards getting this fixed would be to make a pull request that uses @marshallpierce's provided reproduction to create a failing test alongside the other issues we have https://github.com/FasterXML/jackson-module-kotlin/tree/2.13/src/test/kotlin/com/fasterxml/jackson/module/kotlin/test/github/failing |
And just to make sure: test reproductions can not use Lombok directly -- they must use results of Lombok's processing, but Jackson does not (and can not) know anything about that processing: databind and Kotlin modules simple see whatever Lombok's bytecode processor gives. So using Lombok itself is fine but test reproductions cannot use it. |
Agreed. The example at the top of this issue is perfect because it has no dependencies beyond those that j-m-k itself uses https://bitbucket.org/marshallpierce/repro-jackson-kotlin-inheritance/src/master/ |
There are significant difficulties in fixing this problem. First, the annotations given to constructor parameters on Although it is theoretically possible to do this, but it would create other problems, such as the following
I agree that this behavior is not good. For those who want to implement |
Similar issues are summarized in #658. |
Repro: https://bitbucket.org/marshallpierce/repro-jackson-kotlin-inheritance/src/master/
Put briefly, serializing this:
results in the following, which uses the field name instead of what's defined in the annotation
The text was updated successfully, but these errors were encountered: