Change default of DeserializationFeature. FAIL_ON_NULL_FOR_PRIMITIVES
to true
for 3.0
#79
Replies: 3 comments 5 replies
-
It would be better to allow users to specify their own default behavior (maybe through environment variables?) For example, if I am migrating from 2.0 to 3.0 and this behavior differs, it would be far easier to change one environment variable instead of modifying every place where I constructed an ObjectMapper. |
Beta Was this translation helpful? Give feedback.
-
I do not think it is a good idea to expose global singleton style forcing mechanism for defaults: Jackson is a library, used transitively by many things and trying to change defaults from under other libraries or frameworks can be a lethal foot-gun. Instead systems that make heavy use of Jackson should design things so they can set suitable defaults as necessary. I am not sure what I think of EDIT: my main concern, I think, is that a set of things one can configure for more 2.x compatibility is relatively limited. But I guess I am not entirely opposed to the idea. |
Beta Was this translation helpful? Give feedback.
-
After bit over month, poll results are clear: let's change default settings: will approve FasterXML/jackson-databind#4858 . |
Beta Was this translation helpful? Give feedback.
-
(part of #72 uber-Discussion)
As of Jackson 2.x, DeserializationFeature. FAIL_ON_NULL_FOR_PRIMITIVES defaults to false, allowing coercion from JSON null into Java int, long and so on.
For some users -- and especially on "low null" languages like Kotlin -- such coercion is rarely expected, so A suggestion in discussion was made to change the default.
This will improve intuitive-ness of feature default value with which module-extension (like
kotlin-module
). This change will not be done in Jackson 2.x, but for 3.0.0, due to backward-compatibility issue.12 votes ·
Beta Was this translation helpful? Give feedback.
All reactions