Skip to content

Major Design Implementation Issues

Tatu Saloranta edited this page Jun 2, 2024 · 1 revision

Major Design / Implementation Issues

This page contains an overview of bigger areas of Design that have problems big enough that require sizable rewriting to solve.

Document last updated: 03-Jun-2024

Sub-pages

Creator Method handling (solved in 2.18)

One significant issue with creator (@JsonCreator annotated constructor or static method) handling before Jackson 2.18 was that so-called creator properties (ones passed as argument for Creator) are not discovered at same time as regular properties. This was problematic with respect to merging of all information, and lead to some issues regarding things like property renaming.

Initially hoped to get resolved for Jackson 2.9 this issue was FINALLY resolved via databind#4515 included in 2.18.0.

Unwrapped Properties implementation

Implementation behind @JsonUnwrapped annotation does not work very well on deserializer side (typically serialization is easier; issues there, if any, are smaller). The main challenge is that enclosing deserializer (BeanDeserializer) does not have enough information to actually handle such embedded properties: it does know there are "unwrapped" entities, but has no means to detect properties they contain, potentially recursively (since multiple levels of unwrapping are actually supported).

To improve handling, it will be necessary to expose more information, but this alone is not enough to improve handling.

Specific problems include:

  • Since "parent" deserializer literally knows nothing of unwrapped properties (aside from the fact there are some), it can not:
    • Detect which properties are unknown, if any, and hence properties within context of some unwrapped properties are always handled using "ignore all unknown" approach
    • Since it is not known which of unwrapped entities handles which properties, calls are made for all; this causes (minor?) performance overhead.
  • Unwrapping not supported for java.util.Maps. Note, however, that "any properties" may serve similar purpose; except that they do not mix well with unwrapped POJO values.

Active issues:

  • #385: Renaming
  • #650: Unknown properties missed with Unwrapped
  • #917: Unable to have two @JsonUnwrapped annotated object of same type within one constructor
  • #1176: Incorrect deserialization of inner object when using @JsonUnwrapped, with duplicate property

Any Properties (@JsonAnyGetter, @JsonAnySetter)

Currently "any properties" do not work nicely with:

  • Unwrapped handling (since these overlap in a way)
  • Creator properties: it is not possible to pass any properties via Creators. This should not be fundamentally impossible or difficult, just not implemented

Active issues:

  • #518: Sorting not working for "any properties" (NOTE: Serialization issue)
  • #562: Any properties not usable via @JsonCreator

Other Significant (if not major) Issues

Configuring format-specific features via ObjectReader, ObjectWriter

[implemented for Jackson 3.0]

Support for pluggable, format-specific input sources, output targets

Specific use cases: reading from Properties, writing as `Properties, by Java Properties format module