Built-in support for Guava collections
- Dominant language
- Java
- Stars
- 24.2k
- Forks
- 4.5k
- Avg merge
- 6d 4h
- Merged PRs (30d)
- 12
Description
# Problem solved by the feature
Although Gson and Guava are both Google open-source projects, Gson does not have any understanding of Guava collection-related types such as `ImmutableList` and `ImmutableSortedMap`. There is [at least one open-source project](https://github.com/acebaggins/guava-gson-serializers) that provides this functionality, but it does not currently seem to be released anywhere accessible. Internally, Google seems to have at least 12 implementations of `ImmutableListTypeAdapterFactory`.
# Feature description
Make it so that a default `Gson` instance knows how to deserialize into `ImmutableList` and the like, _if_ Guava is on the classpath. We can use reflection and an `` dependency to ensure that Gson does not pull in Guava if it is not already used elsewhere in a project.
# Alternatives / workarounds
Build [`guava-gson-serializers`](https://github.com/acebaggins/guava-gson-serializers) manually, or write your own `TypeAdapterFactory`.
Contributor guide
Assessment
This issue has not been assessed yet.