johnzon icon indicating copy to clipboard operation
johnzon copied to clipboard

Annotation symmetry tests

Open dblevins opened this issue 7 months ago • 1 comments

I noticed some differences in behavior on reading vs writing with JsonbTypeAdapters. They appear to have very different code paths and some caching issues that can alter behavior if reads are done after writes.

These test attempt to verify:

  • behavior is the same for both reading and writing
  • consistent order of preference (overriding)

First round of tests cover JsonbTypeAdapter, JsonbTypeDeserializer and JsonbTypeSerializer. Tests that fail are ignored so this can be a passing PR. Inconsistencies are documented.

Don't have time now, but would like to return to this at some point in the future to cover JsonbDateFormat, JsonbNumberFormat and the four flavors of JohnzonConverter. I would also like to test meta-annotation versions of the above.

dblevins avatar May 13 '25 19:05 dblevins

Discoveries:

  • Reads fail with String JsonbTypeAdapter on deserialized class https://issues.apache.org/jira/browse/JOHNZON-414

  • Reads fail with Array JsonbTypeAdapter on deserialized class https://issues.apache.org/jira/browse/JOHNZON-415

  • Read/write fail with Map JsonbTypeAdapter on deserialized class https://issues.apache.org/jira/browse/JOHNZON-416

  • Read fail with Map or List JsonbTypeAdapter specified via JsonbConfig https://issues.apache.org/jira/browse/JOHNZON-417

  • Inconsistent Precedence with JsonbTypeAdapter https://issues.apache.org/jira/browse/JOHNZON-418

Note all tests that fail have been marked @Ignore. The build will succeed if this PR is merged.

dblevins avatar May 13 '25 19:05 dblevins