Copy JsonProperty annotation to getter#2915
Copy JsonProperty annotation to getter#2915XenoAmess wants to merge 2 commits intoprojectlombok:masterfrom
Conversation
|
I don't understand why copying is necessary at all. IIRC Jackson considers field, getter, and setter as a unit; an annotation on one of them holds for all. |
I provided the test classes. You can just run it to see. |
|
Hi. is there any news? |
|
Jackson's behavior appears strange to me. Why should property annotation merging not occur when there is no setter? |
issue created https://github.com/FasterXML/jackson-core/issues/735 |
|
So my conclusion is that this is (again) a result of the crappy bean-spec. Question is: Should lombok once again try fixing this by copying the annotation? When lombok introduced/extended the copy-to-setter mechanism, that already had unintended side-effects: #2778, #2769 However, you may argue that if lombok copies an annotation to a setter, then it should also be put on a getter. I agree with that. Right now, I don't see a reason why this would cause further issues with Jackson, but I did not investigate further. However, I still vote for lombok to stop copying completely (except for builders). But that's a decision for the maintainers. If the maintainers decide that lombok should also copy Jackson annotations to the getter, this PR is most likely not sufficient. There are several other Jackson annotations that we have to look at, and we need to make sure that this really does not break any more use-cases. |
Yes, I really do. I really hate inconsistency like this... I can't give very much detail as that is somehow company secret, but it has really already bring me some trouble. |
I strongly suggest copy JsonProperty annotation onto getter functions.
tests applied.