You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Change parent type of JsonProcessingException to be RuntimeException #2177
Although choice of JsonProcessingException to extend IOException made sense originally (I think), later developments -- in particular, Java 8 Streams and functional approach in general -- have made use of checked exceptions cumbersome for many use cases.
But due to backwards compatibility concerns, change of base exception type has not been possible within 2.x releases.
Now that we are working on 3.0, however, we can make this change. Compared to alternative of providing alternate subtypes of ObjectMapper, ObjectReader and/or ObjectWriter (ones that do not declare checked exceptions for methods), this leads to simpler API.
For 2.x we may still consider simpler work-arounds (maybe convenience wrappers), but with 3.0 let's rebase.
Note, too, that this will help use of Jackson for some specific cases like serialization of this from toString() (and with #2176).
Reacted by Andy Aylward, Ayush Kumar, Oliver Weiler, Lovro Pandžić, Bruno Hemar, Ivan Laktašić, Matija Matošević, Alexey, kistra, Sathya and 10 more
and I have a branch with mostly complete changes. However, coordination with all modules is required so while this effort is finally active again, it may take a week or two.
The core change has been completed; continuing with related clean up.
Noteworthy related changes:
Addition of replacement exception types:
JsonProcessingException -> JacksonException (added in 2.12)
JsonParseException -> StreamReadException (added in 2.10)
JsonGenerationException -> StreamWriteException (added in 2.13)
JsonMappingException -> DatabindException (added in 2.13)
In all of above cases the new exception type -- planned to replace original one in 3.0 -- will be new super-class so that:
Code that catches exceptions CAN (and eventually SHOULD) start using it, even in 2.x (since existing code that throws either old or new type would still be compatible)
Code that throws exceptions CANNOT start replacing type since existing code that catches old exceptions would not catch new type
To prevent (2), new types are added as abstract types in 2.x and become concrete only in 3.0.
Completed; may work on demoting some aspects of DatabindException (logical location) down to JacksonException but there's separate issue for that already.
Activity
cowtowncoder commentedon Jan 12, 2021
Note: actual change is being done via
jackson-core, as:FasterXML/jackson-core#661
and I have a branch with mostly complete changes. However, coordination with all modules is required so while this effort is finally active again, it may take a week or two.
Start databind-side work on #2177 changes
More #2177 changes, will be a long day...
Some more work for #2177: resolved half of errors (now down to under …
More #2177 work, now under 100 errors
Fixed all test failures related to #2177
cowtowncoder commentedon Jan 19, 2021
A lot of work done, on
exp/jstep-4-for-3.0branches of:jackson-core,jackson-databind(core packages; annotations not affected)and just sent an email to
jackson-dev.Next steps:
and planning on merging the changes tomorrow, January 19th 2021, if all goes well.
Implement #2177 (#3020)
Further exception cleanup (wrt #2177), a few IOExceptions originally …
cowtowncoder commentedon Jan 23, 2021
The core change has been completed; continuing with related clean up.
Noteworthy related changes:
JsonProcessingException->JacksonException(added in 2.12)JsonParseException->StreamReadException(added in 2.10)JsonGenerationException->StreamWriteException(added in 2.13)JsonMappingException->DatabindException(added in 2.13)In all of above cases the new exception type -- planned to replace original one in 3.0 -- will be new super-class so that:
To prevent (2), new types are added as
abstracttypes in 2.x and become concrete only in 3.0.cowtowncoder commentedon Jan 29, 2021
Completed; may work on demoting some aspects of
DatabindException(logical location) down toJacksonExceptionbut there's separate issue for that already.