Javaru

Javaru

Kotlin Coroutine Confidence: What's the IntelliJ IDEA inspection? (pg 133 & 141)

On page 133 in the callout text box, it says:

Did your IDE warn you about this misplaced Thread.sleep()? …

And on page 141 it says:

Have you been keeping an eye out for those IDE warnings? Tools like IntelliJ IDEA or Android Studio can identify the calls we’ve been making to Thread.sleep() and ImageIO.read(), and will let you know that you shouldn’t be using them in a suspending function. …

I’m not getting those warnings in IntelliJ IDEA, and I tend to keep my inspections configured pretty aggressively. And I don’t see them when I switch to the Default inspection profile. Can you tell me what inspection or inspections they are? (If you are not familiar with how to determine the name of the inspection generating a warning, let me know and I can respond with instructions.) Thanks!

Marked As Solved

sam-cooper

sam-cooper

Author of Kotlin Coroutine Confidence

Thanks! This was also recently pointed out to me by a reader in the Kotlin Slack group. What we discovered is that the warnings don’t currently work when the IDE’s K2 mode is turned on. There’s not much I can do about this, so I’m updating the text for the next Beta release to make it clear that many readers won’t see a warning at all. I hope the warning will be reintroduced in later IDE versions.

To answer your question, the specific inspection is Possibly blocking call in non-blocking context, under the JVM languages category.

Sorry for the confusion, and thank you for mentioning it!

You can find the previous Slack discussion about it here:

https://slack-chats.kotlinlang.org/t/27555859/in-kotlin-coroutine-confidence-u030s9809ph-off-the-cuff-says#4d83bb6b-a7de-4eaa-a86c-f3a1476e121c

Popular Pragmatic Bookshelf topics Top

jimschubert
In Chapter 3, the source for index introduces Config on page 31, followed by more code including tests; Config isn’t introduced until pag...
New
New
belgoros
Following the steps described in Chapter 6 of the book, I’m stuck with running the migration as described on page 84: bundle exec sequel...
New
jamis
The following is cross-posted from the original Ray Tracer Challenge forum, from a post by garfieldnate. I’m cross-posting it so that the...
New
patoncrispy
I’m new to Rust and am using this book to learn more as well as to feed my interest in game dev. I’ve just finished the flappy dragon exa...
New
jskubick
I’m under the impression that when the reader gets to page 136 (“View Data with the Database Inspector”), the code SHOULD be able to buil...
New
New
AufHe
I’m a newbie to Rails 7 and have hit an issue with the bin/Dev script mentioned on pages 112-113. Iteration A1 - Seeing the list of prod...
New
tkhobbes
After some hassle, I was able to finally run bin/setup, now I have started the rails server but I get this error message right when I vis...
New
EdBorn
Title: Agile Web Development with Rails 7: (page 70) I am running windows 11 pro with rails 7.0.3 and ruby 3.1.2p20 (2022-04-12 revision...
New

Other popular topics Top

AstonJ
If it’s a mechanical keyboard, which switches do you have? Would you recommend it? Why? What will your next keyboard be? Pics always w...
New
DevotionGeo
I know that these benchmarks might not be the exact picture of real-world scenario, but still I expect a Rust web framework performing a ...
New
AstonJ
Do the test and post your score :nerd_face: :keyboard: If possible, please add info such as the keyboard you’re using, the layout (Qw...
New
PragmaticBookshelf
“Finding the Boundaries” Hero’s Journey with Noel Rappin @noelrappin Even when you’re ultimately right about what the future ho...
New
wmnnd
Here’s the story how one of the world’s first production deployments of LiveView came to be - and how trying to improve it almost caused ...
New
mafinar
This is going to be a long an frequently posted thread. While talking to a friend of mine who has taken data structure and algorithm cou...
New
New
First poster: joeb
The File System Access API with Origin Private File System. WebKit supports new API that makes it possible for web apps to create, open,...
New
New
PragmaticBookshelf
Author Spotlight: Bruce Tate @redrapids Programming languages always emerge out of need, and if that’s not always true, they’re defin...
New