Fix for KT-11969: ProGuard issue with private interface methods
#KT-11969 Fixed
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
// WITH_RUNTIME
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
interface Z {
|
||||
private fun privateFun() = { "OK" }
|
||||
|
||||
fun callPrivateFun() = privateFun()
|
||||
|
||||
fun publicFun() = { "OK" }
|
||||
|
||||
fun funWithDefaultArgs(s: () -> Unit = {}): () -> Unit
|
||||
|
||||
val property: () -> Unit
|
||||
get() = {}
|
||||
|
||||
class Nested
|
||||
}
|
||||
|
||||
class Test : Z {
|
||||
override fun funWithDefaultArgs(s: () -> Unit): () -> Unit {
|
||||
return s
|
||||
}
|
||||
|
||||
fun funWithDefaultArgsInClass(s: () -> Unit = {}): () -> Unit {
|
||||
return s
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
|
||||
val privateFun = Test().callPrivateFun()
|
||||
var enclosing = privateFun.javaClass.enclosingMethod!!
|
||||
if (enclosing.name != "privateFun") return "fail 1: ${enclosing.name}"
|
||||
if (enclosing.getDeclaringClass().simpleName != "DefaultImpls") return "fail 2: ${enclosing.getDeclaringClass().simpleName}"
|
||||
|
||||
val publicFun = Test().publicFun()
|
||||
enclosing = publicFun.javaClass.enclosingMethod!!
|
||||
if (enclosing.name != "publicFun") return "fail 3: ${enclosing.name}"
|
||||
if (enclosing.getDeclaringClass().simpleName != "DefaultImpls") return "fail 4: ${enclosing.getDeclaringClass().simpleName}"
|
||||
|
||||
val property = Test().property
|
||||
enclosing = property.javaClass.enclosingMethod!!
|
||||
if (enclosing.name != "getProperty") return "fail 4: ${enclosing.name}"
|
||||
if (enclosing.getDeclaringClass().simpleName != "DefaultImpls") return "fail 5: ${enclosing.getDeclaringClass().simpleName}"
|
||||
|
||||
val defaultArgs = Test().funWithDefaultArgs()
|
||||
enclosing = defaultArgs.javaClass.enclosingMethod!!
|
||||
if (enclosing.name != "funWithDefaultArgs\$default") return "fail 6: ${enclosing.name}"
|
||||
if (enclosing.parameterTypes.size != 4) return "fail 7: not default method ${enclosing.name}"
|
||||
if (enclosing.getDeclaringClass().simpleName != "DefaultImpls") return "fail 8: ${enclosing.getDeclaringClass().simpleName}"
|
||||
|
||||
val defaultArgsInClass = Test().funWithDefaultArgsInClass()
|
||||
enclosing = defaultArgsInClass.javaClass.enclosingMethod!!
|
||||
if (enclosing.name != "funWithDefaultArgsInClass\$default") return "fail 6: ${enclosing.name}"
|
||||
if (enclosing.parameterTypes.size != 4) return "fail 7: not default method ${enclosing.name}"
|
||||
if (enclosing.getDeclaringClass().simpleName != "Test") return "fail 8: ${enclosing.getDeclaringClass().simpleName}"
|
||||
|
||||
val nested = Z.Nested::class.java
|
||||
val enclosingClass = nested.enclosingClass!!
|
||||
if (enclosingClass.name != "Z") return "fail 9: ${enclosingClass.name}"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
// JVM_TARGET: 1.8
|
||||
// WITH_RUNTIME
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
interface Z {
|
||||
private fun privateFun() = { "OK" }
|
||||
|
||||
fun callPrivateFun() = privateFun()
|
||||
|
||||
fun publicFun() = { "OK" }
|
||||
|
||||
fun funWithDefaultArgs(s: () -> Unit = {}): () -> Unit
|
||||
|
||||
val property: () -> Unit
|
||||
get() = {}
|
||||
|
||||
class Nested
|
||||
}
|
||||
|
||||
class Test : Z {
|
||||
override fun funWithDefaultArgs(s: () -> Unit): () -> Unit {
|
||||
return s
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
|
||||
val privateFun = Test().callPrivateFun()
|
||||
var enclosing = privateFun.javaClass.enclosingMethod!!
|
||||
if (enclosing.name != "privateFun") return "fail 1: ${enclosing.name}"
|
||||
if (enclosing.getDeclaringClass().simpleName != "Z") return "fail 2: ${enclosing.getDeclaringClass().simpleName}"
|
||||
|
||||
val publicFun = Test().publicFun()
|
||||
enclosing = publicFun.javaClass.enclosingMethod!!
|
||||
if (enclosing.name != "publicFun") return "fail 3: ${enclosing.name}"
|
||||
if (enclosing.getDeclaringClass().simpleName != "Z") return "fail 4: ${enclosing.getDeclaringClass().simpleName}"
|
||||
|
||||
val property = Test().property
|
||||
enclosing = property.javaClass.enclosingMethod!!
|
||||
if (enclosing.name != "getProperty") return "fail 4: ${enclosing.name}"
|
||||
if (enclosing.getDeclaringClass().simpleName != "Z") return "fail 5: ${enclosing.getDeclaringClass().simpleName}"
|
||||
|
||||
val defaultArgs = Test().funWithDefaultArgs()
|
||||
enclosing = defaultArgs.javaClass.enclosingMethod!!
|
||||
if (enclosing.name != "funWithDefaultArgs\$default") return "fail 6: ${enclosing.name}"
|
||||
if (enclosing.parameterTypes.size != 4) return "fail 7: not default method ${enclosing.name}"
|
||||
if (enclosing.getDeclaringClass().simpleName != "Z") return "fail 8: ${enclosing.getDeclaringClass().simpleName}"
|
||||
|
||||
val nested = Z.Nested::class.java
|
||||
val enclosingClass = nested.enclosingClass!!
|
||||
if (enclosingClass.name != "Z") return "fail 9: ${enclosingClass.name}"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
public final class Kt11969Kt {
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
|
||||
public final class Test {
|
||||
public method <init>(): void
|
||||
public @org.jetbrains.annotations.NotNull method callPrivateFun(): kotlin.jvm.functions.Function0
|
||||
public @org.jetbrains.annotations.NotNull method funWithDefaultArgs(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): kotlin.jvm.functions.Function0
|
||||
public synthetic static method funWithDefaultArgsInClass$default(p0: Test, p1: kotlin.jvm.functions.Function0, p2: int, p3: java.lang.Object): kotlin.jvm.functions.Function0
|
||||
public final @org.jetbrains.annotations.NotNull method funWithDefaultArgsInClass(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): kotlin.jvm.functions.Function0
|
||||
public @org.jetbrains.annotations.NotNull method getProperty(): kotlin.jvm.functions.Function0
|
||||
public @org.jetbrains.annotations.NotNull method publicFun(): kotlin.jvm.functions.Function0
|
||||
}
|
||||
|
||||
public interface Z {
|
||||
inner class Z/DefaultImpls
|
||||
inner class Z/Nested
|
||||
public abstract @org.jetbrains.annotations.NotNull method callPrivateFun(): kotlin.jvm.functions.Function0
|
||||
public abstract @org.jetbrains.annotations.NotNull method funWithDefaultArgs(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): kotlin.jvm.functions.Function0
|
||||
public abstract @org.jetbrains.annotations.NotNull method getProperty(): kotlin.jvm.functions.Function0
|
||||
public abstract @org.jetbrains.annotations.NotNull method publicFun(): kotlin.jvm.functions.Function0
|
||||
}
|
||||
|
||||
public final class Z/DefaultImpls {
|
||||
inner class Z/DefaultImpls
|
||||
public static @org.jetbrains.annotations.NotNull method callPrivateFun(p0: Z): kotlin.jvm.functions.Function0
|
||||
public synthetic static method funWithDefaultArgs$default(p0: Z, p1: kotlin.jvm.functions.Function0, p2: int, p3: java.lang.Object): kotlin.jvm.functions.Function0
|
||||
public static @org.jetbrains.annotations.NotNull method getProperty(p0: Z): kotlin.jvm.functions.Function0
|
||||
private static method privateFun(p0: Z): kotlin.jvm.functions.Function0
|
||||
public static @org.jetbrains.annotations.NotNull method publicFun(p0: Z): kotlin.jvm.functions.Function0
|
||||
}
|
||||
|
||||
public final static class Z/Nested {
|
||||
inner class Z/Nested
|
||||
public method <init>(): void
|
||||
}
|
||||
Reference in New Issue
Block a user