groostav
11/02/2024, 6:00 AMsuspend fun foo(): Unit {
//noop
}
suspend fun bar(): Unit {
yield()
}
...
fun main(){
val fooReflect: java.lang.Method = makeJavaMethod(::foo)
val barReflect: java.lang.method = makeJavaMethod(::bar)
runBlocking {
suspendCoroutineUnit> { cont ->
val fooResult = fooReflect.invoke(instance, cont)
// fooResult is null, and foo doesnt yield, so i need to call cont.resume(Unit) here..
}
suspendCoroutineUnit> { cont ->
val barResult = barReflect.invoke(instance, cont)
// BarResult is null, but bar does yield, so I cant call cont.resume(Unit) here!
}
}
}
how can i tell based on the java.lang.Method
and its invoke
return value, if I need to call resume
?ephemient
11/02/2024, 11:02 AMjw
11/02/2024, 1:06 PMgroostav
11/02/2024, 7:34 PM