jackson-databind icon indicating copy to clipboard operation
jackson-databind copied to clipboard

Support AutoCloseable with CLOSE_CLOSEABLE feature

Open Logic-32 opened this issue 6 years ago • 2 comments

The documentation for SerializationFeature.CLOSE_CLOSEABLE clearly indicates that it only closes Closeables as of 2.9.9.1. Can it be updated to close AutoCloseables as well?

Ref: https://github.com/FasterXML/jackson-databind/blob/02a7ef5805d86d07fb9794c2d782b67e161a4f1e/src/main/java/com/fasterxml/jackson/databind/ObjectMapper.java#L1074

Logic-32 avatar Jul 17 '19 19:07 Logic-32

Sounds reasonable since starting with 2.8 Java 7 features (and AutoCloseable was added in Java 7) may be used in jackson-databind.

But just to play it safe, I think this should go in 2.10 (2.10.0.pr1 is due out soon anyway).

cowtowncoder avatar Jul 18 '19 05:07 cowtowncoder

Hmmh. Actually, due to added throwing of regular Exception, need to spend bit more time on figuring out intricasies here, so won't be quite as easy as I thought.

cowtowncoder avatar Jul 23 '19 05:07 cowtowncoder