-
-
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
"Duplicate property" issue should mention which class it complains about #1999
Comments
First of all, thank you for reporting this: yes, more context should be provided. And as to throwing exception: not catching the problem is likely a flaw that was fixed, yes. It would be great to improve error message here, and I hope to have time to look into this. But first things first: checking if information is available; would seem likely it is for class. |
@OndraZizka I know you mentioned actual code that triggers this somewhere but would it be possible to have sample code here too? I'd like to reproduce the problem in a unit test. |
Sure, for instance, below.
Full class:
|
I think we use default ObjectMapper but if the exception didn't show up, I'll check if there's some special config in effect. |
@OndraZizka Thank you. Unfortunately I don't think I can yet reproduce the problem as constructors are missing, along with annotations. Anything related to Lombok has to be expanded as no tests can rely on Lombok (it is one of dependencies I explicitly rule out), so result of its class processing need to be expanded, to the degree they are relevant. In this case I think it may add But I think I may be able to add implied annotations and constructor. |
Hmm ok. I tried IDEA Lombok plugin's "delombok" but that didn't actually create the all args constructor. I am not at work now but I will decompile the class which is actually produced. |
@OndraZizka thank you. I was hoping to work on this, but then realized that it really crucially depends on how Lombok decides to annotate the constructor and getters, setters, since exception strongly suggests something odd going on. |
Here is the resulting source (AST).
|
When Jackson 2.9.5 complains about "duplicate property", it does give no reference to the specific class.
If you have hundreds of generated models, it's quite tedious to find out.
I assume it happens with other errors too, at least I found in forums: "Could not find creator property with name 'id'" and some more.
Btw, it started with version 2.9.2 - it did not complain before (I assume that was a bug).
Source:
https://github.com/FasterXML/jackson-databind/blob/f42b0dcf247b3abeab77a785548a4e7e6500909b/src/main/java/com/fasterxml/jackson/databind/deser/impl/CreatorCollector.java
The text was updated successfully, but these errors were encountered: