Files
kotlin-fork/compiler/testData/codegen/box/sam/kt11519.kt
T
2021-02-12 16:52:30 +03:00

46 lines
937 B
Kotlin
Vendored

// TARGET_BACKEND: JVM
// SKIP_JDK6
// SAM_CONVERSIONS: CLASS
// ^ test checks reflection for synthetic classes
// MODULE: lib
// FILE: Custom.java
class Custom<K, V> {
private K k;
private V v;
public Custom(K k, V v) {
this.k = k;
this.v = v;
}
public interface MBiConsumer<T, U> {
void accept(T t, U u);
}
public void forEach(MBiConsumer<? super K, ? super V> action) {
action.accept(k, v);
}
}
// MODULE: main(lib)
// FILE: 1.kt
import java.util.Arrays
fun box(): String {
val instance = Custom<String, String>("O", "K")
var result = "fail"
instance.forEach { a, b ->
result = a + b
}
val superInterfaces = Arrays.toString((Class.forName("_1Kt\$box$1")).genericInterfaces)
if (superInterfaces != "[Custom\$MBiConsumer<java.lang.String, java.lang.String>]") {
return "fail: $superInterfaces"
}
return result
}