rharter / auto-value-gson

AutoValue Extension to add Gson De/Serializer support
Apache License 2.0
607 stars 103 forks source link

Suppress unchecked for generated adapter read & write methods #180

Closed jakekdodd closed 6 years ago

jakekdodd commented 6 years ago

Was going to put this on the constructor, but with the lazy initialization it belongs on the adapter's read and write methods.

Suppresses unchecked warnings for assignment to any TypeAdapter<T> where T itself is a generic type:

set__string_adapter = (TypeAdapter<Set<String>>) gson.getAdapter(TypeToken.getParameterized(Set.class, String.class));