Discussion on fixing the ObjectMapper.readValue
extension function problem(#399).
#934
Labels
ObjectMapper.readValue
extension function problem(#399).
#934
Currently, the
ObjectMapper.readValue
extension function may returnnull
even if the type argumentT
is specified asnon-null
(#399).This problem can be resolved by correcting the following
Here we want to determine what is the appropriate exception to be thrown(This discussion is a continuation from jackson-dev).
Specifications
In a strictly situational case, it is possible that
is T
could befalse
due toObjectMapper
problems.For example, the deserializer may accidentally return
null
, or an inheritedObjectMapper
may accidentally return an incorrect value.In other words, the problem is not necessarily caused by invalid input.
Thus, a simple implementation of
as T
may result in both aNullPointerException
and aClassCastException
.Therefore, I personally think it is better to use the general exception defined in
Jackson
(JsonMappingException
?) or the newly defined custom exception inkotlin-module
.Additional context
This fix does not solve the problem of
StrictNullChecks
not being applied to top-level collections.The text was updated successfully, but these errors were encountered: