Skip to content

Record setter not included from interface (2.15 regression)Β #3938

@cowtowncoder

Description

@cowtowncoder

A technique used to handle "unknown" properties of Records, wherein something like this is done:

interface NoOptionsCommand {
  @JsonProperty("options")
  default void setOptions(JsonNode value) {
    if (value.isNull()) {
       return;
    }
    throw new IllegalArgumentException("Non-null 'options' not allowed for "+getClass().getName());
  }
}


public record FindOneCommand(int id, String filter)
    implements NoOptionsCommand {
}

works with Jackson 2.14, but started failing with 2.15. It looks like "options" is sort of recognized as failure message lists it as known property, but setter is not used or called.

EDIT: actually, the real thing is that buffering is needed: above type is fine, but content MUST not include both id and filter properties.

Metadata

Metadata

Assignees

No one assigned

    Labels

    RecordIssue related to JDK17 java.lang.Record support

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions