Leonid
03/08/2018, 9:20 AMCzar
03/08/2018, 9:22 AMdiesieben07
03/08/2018, 9:22 AMLeonid
03/08/2018, 9:28 AMinterface ITest : java.util.RandomAccess {
fun callback()
}
val tmp = { println() } as ITest
diesieben07
03/08/2018, 9:33 AMClassCastException
.Leonid
03/08/2018, 9:35 AMdiesieben07
03/08/2018, 9:38 AMinterface MyMarker
inline fun MyMarker(crossinline body: () -> Unit): MyMarker = object : MyMarker, () -> Unit {
override fun invoke() = body()
}
However as you can see it returns MyMarker
, so you then don't have a way to invoke it. Or you could make it return () -> Unit
, but then you can't assign it to MyMarker
.Leonid
03/08/2018, 9:48 AM