Closed brianyu0717 closed 7 years ago
This has to do with the fact that, in kotlin, List<T>
is actually List<out T>
, meaning it has declaration site variance.
new TypeToken<List<User>>(){}.getType()
returns java.util.List<com.you.User>
object : TypeToken<List<User>>(){}.type
returns java.util.List<? extends com.you.User>
This will be corrected in Kotson 2.5.0, thanks for the report ;)
Fixed in 2.5.0
Hi, just noticed an issue while using nested types e.g.
Expecting
a
to be of typeArrayList<ArrayList<User>>>
however I'm gettingArrayList<ArrayList<LinkedTreeMap<etc... as per Gson>>>
It looks like it's not getting past the 'first' level generic type.