27c51f5f88
This is what Java 15+ does, and it permits accessing captured type parameters via reflection. The alternative is to emit generic signatures on the lambda methods, but that was disabled and I have no clue why. ^KT-52417 Fixed
19 lines
345 B
Kotlin
Vendored
19 lines
345 B
Kotlin
Vendored
// TARGET_BACKEND: JVM
|
|
// WITH_RUNTIME
|
|
// WITH_STDLIB
|
|
package test
|
|
|
|
abstract class TypeToken<T>
|
|
|
|
fun interface I {
|
|
fun foo(): String
|
|
}
|
|
|
|
fun <T> foo() =
|
|
I {
|
|
(object : TypeToken<T>() {})::class.java.genericSuperclass.toString()
|
|
}.foo()
|
|
|
|
fun box(): String =
|
|
foo<String>().let { if (it == "test.TypeToken<T>") "OK" else it }
|