mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 00:21:47 +00:00
The implementation of toString for generic types in Java reflection has been changed in 8u162 (https://bugs.openjdk.java.net/browse/JDK-8054213)
24 lines
561 B
Kotlin
Vendored
24 lines
561 B
Kotlin
Vendored
// IGNORE_BACKEND: JVM_IR
|
|
// FILE: JavaClass.java
|
|
|
|
class JavaClass {
|
|
interface Computable<T> {
|
|
T compute();
|
|
}
|
|
|
|
static <T> T compute(Computable<T> computable) {
|
|
return computable.compute();
|
|
}
|
|
}
|
|
|
|
// FILE: 1.kt
|
|
|
|
import java.util.Arrays
|
|
|
|
fun box(): String {
|
|
val r: JavaClass.Computable<String> = JavaClass.Computable { "OK" }
|
|
val supertypes = Arrays.toString(r.javaClass.getGenericInterfaces())
|
|
if (supertypes != "[JavaClass\$Computable<java.lang.String>]") return "Fail: $supertypes"
|
|
return JavaClass.compute(r)!!
|
|
}
|