diesieben07
08/25/2018, 1:39 PMKFunction
via a function reference, how do you resolve an "overload resolution ambiguity"?
I am trying to get a KFunction<String>
for ResultSet::getString
, but there are two versions of that (getString(Int)
and getString(String)
). How do I tell the compiler I want the Int
version?udalov
class A {
fun getResult(s: String) {}
fun getResult(i: Int) {}
}
val a: (A, String) -> Unit = A::getResult
diesieben07
08/27/2018, 1:20 PM(A, String) -> Unit
, which is not assignable to KFunction
.udalov
val a: kotlin.reflect.KFunction2<A, String, Unit> = A::getResult
KFunction2
is a synthetic type which extends from KFunction
and `Function2`; erased to KFunction
on JVMdiesieben07
08/31/2018, 1:06 PM