32 lines
711 B
Kotlin
Vendored
32 lines
711 B
Kotlin
Vendored
// TARGET_BACKEND: JVM
|
|
// JVM_TARGET: 1.8
|
|
// SAM_CONVERSIONS: INDY
|
|
// FULL_JDK
|
|
|
|
// CHECK_BYTECODE_TEXT
|
|
// JVM_IR_TEMPLATES
|
|
// 2 java/lang/invoke/LambdaMetafactory
|
|
|
|
// FILE: serializableBoundTopLevelExtensionFunRefPrimitiveReceiver.kt
|
|
import java.io.*
|
|
|
|
fun Int.plusK(k: String) = this.toChar().toString() + k
|
|
|
|
fun box(): String {
|
|
return roundtrip(Sam(('O'.toInt())::plusK))
|
|
.get("K")
|
|
}
|
|
|
|
fun <T> roundtrip(x: T): T {
|
|
val out1 = ByteArrayOutputStream()
|
|
ObjectOutputStream(out1).writeObject(x)
|
|
return ObjectInputStream(ByteArrayInputStream(out1.toByteArray())).readObject() as T
|
|
}
|
|
|
|
// FILE: Sam.java
|
|
import java.io.*;
|
|
|
|
public interface Sam extends Serializable {
|
|
String get(String s);
|
|
}
|