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

Breaking change in `InstantDeserializer API between 2.15 and 2.16 #286

Closed haraldk closed 9 months ago

haraldk commented 9 months ago

Version 2.16 seems to have introduced a breaking change in the API for InstantDeserializer.

Since 6 years ago…. And up until 2.15, the InstantDeserializer constructor looked like this:

    protected InstantDeserializer(Class<T> supportedType,
            DateTimeFormatter formatter,
            Function<TemporalAccessor, T> parsedToValue,
            Function<FromIntegerArguments, T> fromMilliseconds,
            Function<FromDecimalArguments, T> fromNanoseconds,
            BiFunction<T, ZoneId, T> adjust,
            boolean replaceZeroOffsetAsZ)

However, since 2.16 and onwards, it was changed to this:

    protected InstantDeserializer(Class<T> supportedType,
            DateTimeFormatter formatter,
            Function<TemporalAccessor, T> parsedToValue,
            Function<FromIntegerArguments, T> fromMilliseconds,
            Function<FromDecimalArguments, T> fromNanoseconds,
            BiFunction<T, ZoneId, T> adjust,
            boolean replaceZeroOffsetAsZ,
            boolean normalizeZoneId,
            boolean readNumericStringsAsTimestamp
    )

Two new boolean parameters added.

This breaks our custom subclass, that no longer finds it super constructor. To make things worse for us, the subclass is shared between multiple projects, that use different versions of Jackson, so we can't just upgrade and fix it for the latest version...

Can we have the old version (with defaults for the missing parameters) back, please. 😀

If you like, I can make a PR, I just need to figure out what the defaults should be.

cowtowncoder commented 9 months ago

@haraldk Apologies for this... although sub-classing of these (de)serializers is not an originally planned use case, I don't think you are the only developer(s) doing that (or just constructing instances directly as the case may be).

Yes, a PR for 2.16.1 would be accepted; adding old constructor back as @Deprecated, delegating to the new one adding in 2.16.0. I think there are 2 constants added in that class to pass as values for normalizeZoneId and readNumericStringsAsTimestamp.