--- cross-post from <#C0922A726|general> ---- Hel...
# language-proposals
f
--- cross-post from #general ---- Hello. I am trying to use ktor-clients that use reified generics to handle return type and pass it to deserialization routine.
Copy code
httpClient.get<Type>(...): Type <------ return type is handled from reified generic parameter
  
interface JsonSerializer {
suspend fun read(type: KClass<*>, content: IncomingContent): Any <<------ and handled type is used to instantiate object
}
If I pass List<MyObject> as a type parameter, I silently get List of garbage because reified generics does not include inner parameters and only List<*> will be passed to JsonSerializer.read(...) I am wonder why not: 1) either: do not allow to pass classes with inner generics to reified methods 2) or: pass something different then just KClass that supports chain of generics
m
It's interesting that something like
TypeToken
will work here correctly.