FasterXML / jackson-modules-java8

Set of support modules for Java 8 datatypes (Optionals, date/time) and features (parameter names)
Apache License 2.0
398 stars 116 forks source link

JSR310DateTimeDeserializerBase#withDateFormate implementations without this as base class #276

Closed raman-babich closed 1 year ago

raman-babich commented 1 year ago

I was analyzing the sources and have found some strange things.

classes don't use this as base when ovverriding JSR310DateTimeDeserializerBase#withDateFormate and therefore we can loose leniency and shape. What is the real intention of such code or is it a bug? If this is inteded behaviour, e.g. because implementations don't use leniency and shape and only care about formatter, there is another strange thing why does withShape is ignored by returning this almost everywhere but ignoring 'withLeniency' leads to new deser made?

LocalTimeDeserializer as an example

cowtowncoder commented 1 year ago

Without remembering details here I would lean towards it being a simple bug (oversight): whenever creating something using withXxx() it does seem like this ought to be passed.

As to withShape() returning this, that is likely due to that particular deserializer not using shape for changing behavior. Shape is more commonly used with serializers. But it is worth checking for individual deserializers if you have time to do so.

Thank you for doing good due diligence here!

raman-babich commented 1 year ago

Ok, I will make a pr after merge of #272 if I have time.