At least this should work with inline/reified to h...
# language-proposals
m
At least this should work with inline/reified to hide unnecessary argument.
Copy code
open class TypeToken<T>

inline fun <reified T: Any> write(obj: T) {
    val token = object : TypeToken<T>() {}
    token::class.supertypes[0].arguments[0].type
}