Skip to content

Add MapperFeature.REQUIRE_HANDLERS_FOR_JAVA8_OPTIONALS to prevent failure of java.util.Optional (de)serialization without Java 8 module #5006

Description

@cowtowncoder

(note: follow-up to #4499)

So: looks like #4082 has caused many problems and although direction is clear wrt canonical (de)serialization of Optionals (basically what https://github.com/FasterXML/jackson-modules-java8/ adds), it seems reasonably to add a MapperFeature that basically disables checks #4082 adds.

What this means is that when the new MapperFeature (Name To Be Decided) is changed:

  1. java.util.Optional handling proceeds the way it would with no checks -- specifically, it is fine if default Bean-style handling occurs
  2. No exception is thrown for missing explicit java.util.Optional handlers

It may seem odd to add a "feature to disable another newish feature", but this seems minimal path that achieves goals of #4082 while still allowing backwards-compatibility for users that depended on old handling (esp. with explicit visibility changes).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions