https://kotlinlang.org logo
#coroutines
Title
# coroutines
c

christophsturm

04/25/2020, 11:43 AM
why does idea mark
jackson.readValue(string, class)
as Inappropiate blocking call in a suspend method?
h

hallvard

04/25/2020, 12:16 PM
Because its inspections aren't good enough (yet?). Apparently, if you specify Dispatchers.IO close enough, it doesn't complain, but if the calling function is «far away» from the suspend function, it isn't quite certain about which dispatcher will run the code.
c

christophsturm

04/25/2020, 12:22 PM
but that method is never blocking, it does no IO
a

Arkadii Ivanov

04/25/2020, 1:43 PM
Parsing json may also block. Perhaps this is the case.
h

hallvard

04/25/2020, 1:54 PM
Doesn't Jackson push the string into a Reader (I am taking this from memory now)? Are you certain there are no special circumstances or implementations where this might block?
k

Kroppeb

04/25/2020, 2:15 PM
Intellij assumes functions throwing IOException are blocking
☝️ 1
c

christophsturm

04/25/2020, 4:01 PM
its not throwing IOException. not in the latest stable version that I am using
3 Views