-
Dependency import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking |
Beta Was this translation helpful? Give feedback.
Answered by
schalkms
Aug 27, 2022
Replies: 2 comments
-
Please don't post screenshots. It's extremely hard for us as we can't copy and paste your code. |
Beta Was this translation helpful? Give feedback.
0 replies
-
The posted code doesn't trigger the @Test
fun `discussion #5231`() {
val code = """
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
class Test {
fun networkRequestTest() {
runBlocking(Dispatchers.IO) {
doNetworkRequest("test1")
doNetworkRequest("test2")
}
}
private suspend fun doNetworkRequest(name: String) {
if (name == "11") {
throw IllegalArgumentException()
}
delay(1000L)
}
}
"""
assertThat(subject.compileAndLintWithContext(env, code)).isEmpty()
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
schalkms
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The posted code doesn't trigger the
RedundantSuspendModifier
rule during my test with the following test code snippet.I think type resolution isn't correctly configured in your project.