Add JsonDeserializationContext.deserialize
overload with TypeToken
parameter
#2216
Labels
JsonDeserializationContext.deserialize
overload with TypeToken
parameter
#2216
Problem solved by the feature
Similar to #1700
JsonDeserializationContext
should have adeserialize
overload withTypeToken
parameter to provide type-safety, and the documentation should then recommend that overload.Feature description
Since
JsonDeserializationContext
is an interface and might be implemented by users, thedeserialize
overload would have to be implemented as interfacedefault
method. Therefore this has to wait until Gson targets Java 8 or newer.The
default
method could then simply delegate to the other overload, though Gson's internal implementation could override it to directly callGson.fromJson(..., TypeToken)
.Maybe it would also be worth considering to deprecate the existing method with
Type
parameter, see also #2328.The text was updated successfully, but these errors were encountered: