users@jsonb-spec.java.net

[jsonb-spec users] Public Draft Feedback

From: <gunnar.morling_at_googlemail.com>
Date: Thu, 9 Mar 2017 23:12:11 +0000 (UTC)

Hi,

In the course of my exploration of integrating JSON-B and Bean
Validation, I got some general remarks/questions which I thought would
be worth sharing:

* JsonbConfig#withFormatting() and withNullValues(): why do these take
a Boolean instead of a primitive boolean? What's the semantics of
passing null?

* JsonbConfig#withAdapters(): how are those applied exactly? If I e.g.
pass an adapter for A, will it be applied for B extends A? It seems not
to be the case with the RI currently, but that'd seem useful. If an
adapter is given via @JsonbTypeAdapter, does it take precedence over a
matching adapter given via withAdapters()? I couldn't find rules for
adapter resolution.

* JsonbTypeAdapter: It supports targets ANNOTATION_TYPE, TYPE, FIELD,
and METHOD, but the javadocs only mention the latter two

* Serialization of graphs with cycles: the RI caused me a stack
overflow when trying to do this; shouldn't rather an exception be
raised that a cycle was detected, indicating the involved nodes? I
couldn't find anything on this topic in the spec. @JsonbTransient
together with something like JAXB's afterUnmarshal() [1] might help to
address this case

* 3.6 Untyped Mapping: for true/false, why is it Boolean over boolean?

* Jsonb: JavaDocs mention fromJson()/toJson() accepting a File, but
it's not there in the code

* Jsonb#toJson(): What is the purpose of the type parameter? In which
situation would this be different from the given object's type?

* Jsonb/JsonbBuilder: Are implementations supposed to be thread-safe?
I.e. can one safely keep them as application-scoped beans?

* JsonbProvider: I'd suggest to add a provider() overload accepting a
classloader which can be passed to the service loader

Cheers,

--Gunnar

[1]
http://docs.oracle.com/javaee/7/api/javax/xml/bind/Unmarshaller.Listene
r.html#afterUnmarshal-java.lang.Object-java.lang.Object-