I'm seeing that Kotlin conforms to the same type e...
# kontributors
j
I'm seeing that Kotlin conforms to the same type erasure issues as Java, where e.g. a generic type cannot be used at runtime in a generic function implementation. Has JB considered getting around this by having Kotlin generate JVM bytecode which implicitly passes generic types as caller's inputs into generic functions? This would incur the runtime overhead that type erasure avoids, but it's exactly what's happening when people use the
Copy code
fun <T> foo(clazz: Class<T>)
pattern. I'm thinking as a compromise, and to maintain possible binary compatibility with Java and previous Kotlin versions, there would be an opt-in symbol to enable this behavior for each generic type. Something like
Copy code
fun <T*> foo()
What do you guys think about this approach?