Why does this not work? ```fun CoroutineScope.lau...
# coroutines
c
Why does this not work?
Copy code
fun CoroutineScope.launchIO(block: suspend CoroutineScope.() -> Unit): Job {
    return launch(
        context = IO,
        start = CoroutineStart.DEFAULT,
        block = block
    )
}
If I try to use this in place of the regular launch I get the following error:
java.lang.NoSuchMethodError: 'kotlinx.coroutines.Job com.some.misc.ExtensionsKt.launchIO(kotlinx.coroutines.CoroutineScope, kotlin.jvm.functions.Function2)'
I am more curious as to what I'm missing here rather than this being a serious use case
j
NoSuchMethodError
usually sounds like the runtime classpath is missing something that was there at compile time. How are you compiling and running this code and the code that calls it?
c
This is part of a ktor project which I'm running using the gradle run task
j
Is this a multi-module project? Maybe the module containing
launchIO
is declared as
compileOnly
dependency of the module using it?
j
@cah I'm able to compile and run your code without errors.