Generate SAM wrappers only if they are required for a given argument
SAM interface wrapper for an argument is required, if in the function descriptor for SAM adapter type for the corresponding value parameter doesn't match type of the corresponding value parameter in the original (Java) descriptor. #KT-19251 Fixed Target versions 1.1.5
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
// FULL_JDK
|
||||
// FILE: test.kt
|
||||
fun box(): String {
|
||||
val map = mutableMapOf<Fun, String>()
|
||||
val fn = Fun { TODO() }
|
||||
return map.computeIfAbsent(fn, { "OK" })
|
||||
}
|
||||
|
||||
// FILE: Fun.java
|
||||
public interface Fun {
|
||||
String invoke(String string);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
// FULL_JDK
|
||||
// FILE: test.kt
|
||||
fun box(): String {
|
||||
val map = mutableMapOf<Fun, String>()
|
||||
val fn = DerivedFun { TODO() }
|
||||
return map.computeIfAbsent(fn, { "OK" })
|
||||
}
|
||||
|
||||
// FILE: Fun.java
|
||||
public interface Fun {
|
||||
String invoke(String string);
|
||||
}
|
||||
|
||||
// FILE: DerivedFun.java
|
||||
public interface DerivedFun extends Fun {}
|
||||
Reference in New Issue
Block a user