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"
}
@@ -12,6 +12,7 @@ static class Foo$Erased {
public final static @org.jetbrains.annotations.NotNull method box(p0: int): Foo
public static method constructor(p0: int): int
public static method equals(p0: int, @org.jetbrains.annotations.Nullable p1: java.lang.Object): boolean
public final static method equals--impl(p0: int, p1: int): boolean
public static method hashCode(p0: int): int
public final static method inInlineClass(p0: int): void
public static @org.jetbrains.annotations.NotNull method toString(p0: int): java.lang.String
@@ -4,6 +4,7 @@ static class Foo$Erased {
public final static @org.jetbrains.annotations.NotNull method box(p0: int): Foo
public static method constructor(p0: int): int
public static method equals(p0: int, @org.jetbrains.annotations.Nullable p1: java.lang.Object): boolean
public final static method equals--impl(p0: int, p1: int): boolean
public final static method getAsThis(p0: int): int
public final static method getProp(p0: int): int
public static method hashCode(p0: int): int
@@ -5,6 +5,7 @@ static class Foo$Erased {
public static method constructor(p0: int): int
public static method constructor(p0: long): int
public static method equals(p0: int, @org.jetbrains.annotations.Nullable p1: java.lang.Object): boolean
public final static method equals--impl(p0: int, p1: int): boolean
public static method hashCode(p0: int): int
public static @org.jetbrains.annotations.NotNull method toString(p0: int): java.lang.String
}
@@ -9,6 +9,7 @@ static class Foo$Erased {
public final static @org.jetbrains.annotations.NotNull method box(p0: long): Foo
public static method constructor(p0: long): long
public static method equals(p0: long, @org.jetbrains.annotations.Nullable p1: java.lang.Object): boolean
public final static method equals--impl(p0: long, p1: long): boolean
public static method foo-1e4ch6lh(p0: long, p1: long): void
public static method hashCode(p0: long): int
public static @org.jetbrains.annotations.NotNull method toString(p0: long): java.lang.String
@@ -5,6 +5,7 @@ static class Foo$Erased {
public static method constructor(p0: long): long
public final static method empty(p0: long): void
public static method equals(p0: long, @org.jetbrains.annotations.Nullable p1: java.lang.Object): boolean
public final static method equals--impl(p0: long, p1: long): boolean
public final static method extension(p0: long, @org.jetbrains.annotations.NotNull p1: java.lang.Object, @org.jetbrains.annotations.NotNull p2: java.lang.String): void
public static method hashCode(p0: long): int
public final static method param(p0: long, p1: double): void