Skip to content

Serializing Map.Entry as Bean with @JsonFormat.shape = Shape.OBJECT fails on JDK 17+ #4963

@cowtowncoder

Description

@cowtowncoder

So, with configuration like:

 ObjectMapper mapper = JsonMapper.builder()
                .withConfigOverride(Map.Entry.class, cfg ->
                    cfg.setFormat(JsonFormat.Value.forShape(JsonFormat.Shape.OBJECT)))
                .build();

attempts to serialize Map.Entry of JDK Maps (like LinkedHashMap) fails due to access problems (unless --add-opens is used).

There is an existing test that fails this way. But we should be able to have a serializer that works with public API in this case.

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