Skip to content
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

Fixes #1573 #1574

Merged
merged 2 commits into from
Mar 28, 2017
Merged

Fixes #1573 #1574

merged 2 commits into from
Mar 28, 2017

Conversation

senojj
Copy link
Contributor

@senojj senojj commented Mar 24, 2017

Please excuse the trailing whitespace removal. My IDE likes to keep things tidy.

Essentially, the logic was cutting short the processing of settable properties. I deleted the code which caused the premature return, and now all settable properties are able to be processed appropriately with the object construction happening at the end of the function after the primary loop.

@cowtowncoder
Copy link
Member

Would it be possible to have a unit test for this? Part of this would be to ensure fix, but most importantly guard against regression. Also would be good to know if master has the issue: code has changed for this method and it's possible problem either has been fixed, or will have to tackled differently.

@senojj
Copy link
Contributor Author

senojj commented Mar 24, 2017

Absolutely. I apologize for not already providing tests for this. I was in a hurry, and just shoved everything I had up. I'll provide the tests sometime tonight or this weekend.

@cowtowncoder
Copy link
Member

@jjware np at all, thank you for submitting this!

@senojj
Copy link
Contributor Author

senojj commented Mar 27, 2017

I will have tests published to this pull request shortly. I just wanted to mention that while building my tests, I found out that using a builder constructor parameter annotated with @JsonUnwrapped does not work and yields an exception pertaining to unknown fields. This makes me think that the parser is not picking up on the @JsonProperty annotations of the unwrapped class. This is a separate issue that I will try to address after finishing with this one.

@cowtowncoder
Copy link
Member

@jjware Problems with unwrapping are not entirely unexpected, since no introspection is or can be done from that point: all code knows is that POJO in question contains some properties, and so anything otherwise unknown must be buffered, and attempt to bind them must be done at a later point. I really wish I had not implemented @JsonUnwrapped at all, it's a messy implementation.
But in all likelihood if it's to be supported, handling needs to be rewritten for 3.x to access and use information on contained properties: this allows detection of actually unknown properties.

In the meantime it sounds like initial problem is resolved so I'll merge this.
Thank you again!

@cowtowncoder cowtowncoder merged commit e08dafe into FasterXML:2.8 Mar 28, 2017
@cowtowncoder cowtowncoder added this to the 2.8.8 milestone Mar 28, 2017
@senojj
Copy link
Contributor Author

senojj commented Mar 28, 2017

@cowtowncoder I can completely understand how the @JsonUnwrapped implementation can get pretty messy, however, I will tell you that I absolutely love what you have done with it. It's existence has removed the need for a transformation layer between the target API models and and my domain models.

@cowtowncoder
Copy link
Member

@jjware Thank you for sharing this. I do know that it is widely used (if not for nothing else due to bug reports :) ), and due to wide usage will do my best to try to keep it working. Thank you for helping with this.

For Jackson 3.x I think it should be possible to rewrite handling to work much better; and this could also help with some other related things, such as "any" properties.

@senojj senojj deleted the 2.8 branch May 9, 2017 16:09
@senojj senojj restored the 2.8 branch May 9, 2017 20:26
@senojj senojj deleted the 2.8 branch May 9, 2017 20:28
@senojj senojj restored the 2.8 branch May 9, 2017 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants