-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Consider adding UncheckedObjectReader
/-Writer
(or Safe-
)
#779
Comments
Having an API with unchecked exceptions would be very useful with Java8 lambdas, so +1 for this. One note: subclassing may impose a performance hit on method dispatch (formerly monomorphic call-sites may become polymorphic). So perhaps delegation without subclassing might be appropriate. |
Having thought bit more about this, I think it would make more sense to expose unchecked/"safe" variants of
|
UncheckedObjectReader
/-Writer
(or Safe-
)
While no work has started here, I think that work towards builder-based Or, alternatively, if sub-classing seems desireable, should be much easier to pull off as-well. |
This will actually be resolved by quite a different approach: just make exceptions unchecked in 3.x: https://github.com/FasterXML/jackson-future-ideas/wiki/JSTEP-4 Closing this issue. |
(note: inspired by #778)
Given that use of checked exceptions can be problematic for some use cases, perhaps it would make sense to implement an
ObjectMapper
-like abstraction that can wrap an actualObjectMapper
, but expose set of methods that do NOT throwIOException
(and subtypes), but rather wrap such exceptions asRuntimeException
s.Actually, since it is ok for sub-class to remove exceptions from signature, this could just be a sub-class of
ObjectMapper
, for improved compatibility (cast asObjectMapper
there is no benefit wrt exception declarations, but it would work).However, implementation should still use delegation model instead of sub-classing, to support use with other
ObjectMapper
subtypes, likeXmlMapper
.This is a half-baked idea at this point, so feel free to add comments for improvements, or for/against the idea. Note however that API definition of
ObjectMapper
itself is not under discussion for Jackson 2.x, at least; and even for 3.x change to unchecked exceptions would be a major change and would need separate discussion.The text was updated successfully, but these errors were encountered: