I'm planning to call method in suspend function th...
# coroutines
k
I'm planning to call method in suspend function that will throw IOException. In this case, IDE warn it as
Inappropriate blocking method call
. So, Should not I call method(will throw IOE) in suspend function?
Copy code
suspend fun foo() {
    // warning: Inappropriate blocking method call
    throwIoException()

    withContext(<http://Dispatchers.IO|Dispatchers.IO>) {
        // warning: Inappropriate blocking method call
        throwIoException()
    }
}

@Throws(IOException::class)
fun throwIoException() {
    // something blocking process
}
o
doing it in IO dispatcher is fine
really IntelliJ shouldn't be warning there (second time, first time is valid) , and just like in the other thread it works for me without a warning, but apparently some how this is different for you
k
I see. But, IDE still warn when wrap as
withContext(<http://Dispatchers.IO|Dispatchers.IO>)
. So you mean that IDE is wrong?
o
yes
k
Is it (still warn in withContext) occurring just my environment only..?
o
probably, I don't have my ide on hand right now but I have only seen the issue with flowOn, never withContext
k
I see... 🤔
e
I have the same issue, see my response to the previous thread.