jackson-modules-java8 icon indicating copy to clipboard operation
jackson-modules-java8 copied to clipboard

Unable to serialize JavaTimeModule object (in 2.x)

Open ghost opened this issue 5 years ago • 2 comments

Hi,

The JavaTimeModule class registers bunch of deserializers that extends JSR310DateTimeDeserializerBase. This class implements java.io.Serializable interface but at the same time it has a reference to java.time.format.DateTimeFormatter object which is not serializable. Looking at the implemented interfaces (of both classes: JavaTimeModule and JSR310DateTimeDeserializerBase) I would expect not to see NotSerializableException during serialization.

regards

ghost avatar Apr 02 '19 11:04 ghost

Ok thank you for reporting this -- I will move the issue under correct repo and see if I can reproduce actual issue.

cowtowncoder avatar Apr 12 '19 02:04 cowtowncoder

FWTW, Jackson 3.0 can serialize these fine, but with 2.x (including 2.10), only other 2 modules (java8 datatypes; parameter names) are serializable. Problem is java.time.format.DateTimeFormatter which is not serializable and that we rely on.

cowtowncoder avatar May 05 '19 21:05 cowtowncoder

Quick note: this is not something we can fix at all for Jackson 2.x. But is fixed for 3.0 (master), so closing.

cowtowncoder avatar Nov 21 '23 04:11 cowtowncoder