it will remove the warning. I assume because it is actually not blocking it is the right thing to do, but I am no expert in coroutines...
s
streetsofboston
05/17/2021, 2:01 PM
The code 'linter' assumes that any method (block of code) that throws an IOException (or a sub-class of it) is blocking. This assumption is often right but also often wrong 🙂
✅ 1
h
hho
05/17/2021, 2:11 PM
Ah, that explains it. Thank you both, I'll go with suppressing the warning for now.
Also in this particular case it depends how big json is, it can be a heavy computation, but probably if you use string it's not so big
h
hho
05/18/2021, 8:24 AM
You're right, it's <2kB.
What would be the right way to do this, if this gets larger?
g
gildor
05/18/2021, 9:12 AM
use another readTree overload and pass there Reader/InputStream and wrap this line to IO dispatcher (if this InputStream/Reader is reading from network/disk) or with Default dispatcher (if it some runtime-generated JSON, so there is a chance that CPU is bottle neck)