Is it possible to infer the generic type of a generic in a reified function? For example;
inline fun <reified T: List<U>> getListType() = U::class.java
I know I can do it this way;
inline fun <reified U, reified T: List<U>> getListType() = U::class.java
But I was wondering if it’s possible to extract the generic type of the generic in the first one, so it can just be called like getListType<ArrayList<String>>
as opposed to getListType<String, ArrayList<String>()
.
The actual purpose of the function I’m trying to write isn’t to get the type of an element of an array, but the generic type of a deserializer.