Major Design Issues - FasterXML/jackson-future-ideas GitHub Wiki

Major Design 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: 14-Jan-2017

Sub-pages

Creator Method handling

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

What is needed is a complete rewrite of property detection, so that handling of Creator properties is integral part along with detection of field and method-backed properties.

NOTE: this work was planned to be worked on 2.9, but likely to be postponed

Active issues:

  • #754: External type id
  • #870: Visibility of accessor related to implicitly named creator affects delegating ctor selection
  • #1118: Cannot ignore a property that comes in through an @JsonCreator

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:

  • #171: Won't work with Maps
  • #383: Recursive unwrapped
  • #385: Renaming
  • #650: Unknown properties missed with Unwrapped
  • #917: Unable to have two @JsonUnwrapped annotated object of same type within one constructor
  • #1046: @JsonUnwrapped and @JsonView don't work together
  • #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
  • #1142: Support @JsonIgnoreProperties for "any setter"

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