Generate stub for specialized equals inside inline class

This commit is contained in:
Mikhail Zarechenskiy
2018-09-05 17:11:23 +03:00
parent b4674a172e
commit 83975bd6ac
14 changed files with 137 additions and 2 deletions
@@ -0,0 +1,25 @@
// WITH_REFLECT
// FULL_JDK
// IGNORE_BACKEND: JVM_IR, JS_IR, JS, NATIVE
import java.lang.reflect.InvocationTargetException
inline class Simple(val x: String) {
fun somethingWeird() {}
}
fun box(): String {
var s = ""
val name = "equals--impl"
val specializedEquals =
Class.forName("Simple\$Erased").getDeclaredMethod("equals--impl", 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"
}