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

NullProvider has been removed #15

Closed
jorgheymans opened this issue Mar 23, 2017 · 5 comments
Closed

NullProvider has been removed #15

jorgheymans opened this issue Mar 23, 2017 · 5 comments

Comments

@jorgheymans
Copy link

It seems that NullProvider was removed from jackson 2.8 onwards, this library is still using it. It's on their deprecated list for 2.7 (https://fasterxml.github.io/jackson-databind/javadoc/2.7/deprecated-list.html) but it doesn't say how to replace it.

@jhaber
Copy link
Member

jhaber commented Mar 23, 2017

Thanks for the tip! I believe I found NullProvider by looking through the Jackson source and seeing how it handles null values, I'll take a look at the 2.8 source and see what it does now.

@cowtowncoder
Copy link

Worth noting that NullProvider has not been used sine 2.6, although class itself was left for bit longer.
I can probably help but I'd need to know what the intended usage was.

@jhaber
Copy link
Member

jhaber commented Mar 24, 2017

I use it when I encounter a null value during deserialization of primitives, such as here. The intention was to avoid dealing directly with DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES; I thought going through NullProvider would be more robust than trying to duplicate the logic. In general I was trying to keep the protobuf deserializer behavior similar to BeanDeserializer (make sure we throw the same exception with the same message, for example), but it seems like duplicating the code may be the way to go.

@cowtowncoder
Copy link

Ah. So as a convenient checker for whether nulls may be coerced.
I did not realize anyone was using, outside of use by SettableBeanProperty, which is why it was removed.

Code duplication may indeed be the way to go, since the only (?) pluggable way I can think of is to access deserializers for relevant types (like int == Integer.TYPE), which is possible, but some work for maybe minor gain. Doing that would require implementing ResolvableDeserializer (method resolve(...) to fetch deserializers to delegate to (in theory it can be done from deserialize(...) but lookups are relatively expensive.
One benefit there would be to get fully standard checks and coercions (like unwrapping of single-element arrays).

Then again, handling of nulls is the same for all primitives so maybe amount of duplication is limited.

@stevenschlansker
Copy link

This issue can probably be closed now.

@jhaber jhaber closed this as completed Sep 13, 2017
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

No branches or pull requests

4 participants