mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-13 00:21:28 +00:00
27 lines
681 B
Kotlin
Vendored
27 lines
681 B
Kotlin
Vendored
// WITH_REFLECT
|
|
// FULL_JDK
|
|
// IGNORE_BACKEND: JVM_IR
|
|
// TARGET_BACKEND: JVM
|
|
|
|
import java.lang.reflect.InvocationTargetException
|
|
|
|
inline class Simple(val x: String) {
|
|
fun somethingWeird() {}
|
|
}
|
|
|
|
fun box(): String {
|
|
var s = ""
|
|
val name = "equals-impl0"
|
|
val specializedEquals =
|
|
Simple::class.java.getDeclaredMethod(name, String::class.java, String::class.java)
|
|
?: return "$name not found"
|
|
|
|
try {
|
|
specializedEquals.invoke(null, "a", "b")
|
|
} catch (e: InvocationTargetException) {
|
|
return if (e.targetException is NullPointerException) "OK" else "${e.targetException}"
|
|
}
|
|
|
|
return "Reserved method invoked successfully"
|
|
}
|