Files
kotlin-fork/compiler/testData/codegen/box/sam/samConstructorGenericSignature.kt
T
Ivan Kylchik c7435ba760 Replace all occurrences of WITH_RUNTIME with WITH_STDLIB
We are going to deprecate `WITH_RUNTIME` directive. The main reason
behind this change is that `WITH_STDLIB` directive better describes
its meaning, specifically it will add kotlin stdlib to test's classpath.
2021-11-17 15:26:38 +03:00

30 lines
692 B
Kotlin
Vendored

// TARGET_BACKEND: JVM
// SKIP_JDK6
// WITH_STDLIB
// SAM_CONVERSIONS: CLASS
// ^ test checks reflection for synthetic classes
// MODULE: lib
// FILE: JavaClass.java
class JavaClass {
interface Computable<T> {
T compute();
}
static <T> T compute(Computable<T> computable) {
return computable.compute();
}
}
// MODULE: main(lib)
// 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 != "[interface JavaClass\$Computable]") return "Fail: $supertypes"
return JavaClass.compute(r)!!
}