Skip to content
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

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

Closed
haraldk opened this issue Nov 17, 2023 · 1 comment
Closed

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

haraldk opened this issue Nov 17, 2023 · 1 comment

Comments

@haraldk
Copy link

haraldk commented Nov 17, 2023

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
Copy link
Member

@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.

haraldk added a commit to nrkno/jackson-modules-java8 that referenced this issue Nov 18, 2023
@cowtowncoder cowtowncoder changed the title Breaking change in InstantDeserializer public API between 2.15 and 2.16 Breaking change in `InstantDeserializer API between 2.15 and 2.16 Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants