Skip to content

@JsonAdapter ignored when relied upon by types in different compilation units #434

@benalexau

Description

@benalexau

I have come across an interesting edge case which looks like a bug.

I have a JsonAdapter for Ulid. This works fine if I use the Ulid in a type in the same compilation unit as the adapter. However, if I move the relying type into a different compilation unit it will fail with "non public field msb with no matching setter or constructor?" and "non public field lsb with no matching setter or constructor?".

I thought perhaps this was related to the Ulid being in an external library, but even copying that type directly into the same compilation unit as the adapter fails.

To reproduce this I have two minimal examples:

The minimal examples also include a "magic number" adapter and record.

Both examples will work if you either:

  • Move the Example.java from test into main; or
  • Edit Example and remove the ulid component (retaining the magicNumber component)

Sub-issues

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