Add `JsonDeserializationContext.deserialize` overload with `TypeToken` parameter
- Dominant language
- Java
- Stars
- 24.2k
- Forks
- 4.5k
- Avg merge
- 6d 4h
- Merged PRs (30d)
- 12
Description
# Problem solved by the feature
Similar to #1700 `JsonDeserializationContext` should have a `deserialize` overload with `TypeToken` 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, the `deserialize` overload would have to be implemented as interface `default` 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 call `Gson.fromJson(..., TypeToken)`.
Maybe it would also be worth considering to deprecate the existing method with `Type` parameter, see also #2328.
Contributor guide
Assessment
This issue has not been assessed yet.