masteramyx
07/05/2023, 5:11 PMBuildersKt.launch()
.
In my domain layer, we have some suspending functions.
override suspend fun voidPayment(uid: String): Boolean
Right now, these suspending functions need to be called from java Activity/Fragment.
Job voidJob = BuildersKt.launch(
GlobalScope.INSTANCE,
(CoroutineContext) Dispatchers.getIO(),
CoroutineStart.DEFAULT,
(scope, cont) -> {
outsideVariable.set(object.voidPayment(uid))
voidable.set(Boolean.parseBoolean(janePayProcessor.voidPayment(mOrder.total, mOrder.tuid, (Continuation<? super Boolean>) cont).toString()));
if (voidable.get())
actuallyProceedWithVoid();
return true;
});
The execution of the suspending function results in an internal coroutine error
kotlinx.coroutines.CoroutinesInternalError: Fatal exception in coroutines machinery for DispatchedContinuation[Dispatchers.Default, Continuation at object.voidPayment(object.kt:64)@d43fc03]. Please read KDoc to 'handleFatalException' method and report this incident to maintainers
at kotlinx.coroutines.DispatchedTask.handleFatalException$kotlinx_coroutines_core(DispatchedTask.kt:146)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:117)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Completed}@4a17bac, Dispatchers.Default]
Caused by: java.lang.ClassCastException: kotlin.coroutines.jvm.internal.CompletedContinuation cannot be cast to kotlinx.coroutines.internal.DispatchedContinuation
Any insights on this?Francesc
07/05/2023, 5:23 PMmasteramyx
07/05/2023, 5:24 PMFrancesc
07/05/2023, 5:25 PMJoffrey
07/05/2023, 6:37 PMstreetsofboston
07/06/2023, 11:35 AM