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 
that's merged now.

 - https://github.com/apache/johnzon/pull/131

Discoveries:

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

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

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

 - Read fail with Map or List JsonbTypeAdapter specified via JsonbConfig 
(writes succeed, string reads succeed)
    https://issues.apache.org/jira/browse/JOHNZON-417

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


Issues 414 to 417 could likely be fixed in 2.0.x.  Fixing 418 would likely 
require a 2.1.x.

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.  Any thoughts on fixes are also very welcome.


-David

Reply via email to