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

Where Next?

Popular Pragmatic Bookshelf topics Top

telemachus
Python Testing With Pytest - Chapter 2, warnings for “unregistered custom marks” While running the smoke tests in Chapter 2, I get these...
New
brianokken
Many tasks_proj/tests directories exist in chapters 2, 3, 5 that have tests that use the custom markers smoke and get, which are not decl...
New
mikecargal
Title: Hands-on Rust: question about get_component (page 295) (feel free to respond. “You dug you’re own hole… good luck”) I have somet...
New
conradwt
First, the code resources: Page 237: rumbl_umbrella/apps/rumbl/mix.exs Note: That this file is missing. Page 238: rumbl_umbrella/app...
New
joepstender
The generated iex result below should list products instead of product for the metadata. (page 67) iex> product = %Product{} %Pento....
New
alanq
This isn’t directly about the book contents so maybe not the right forum…but in some of the code apps (e.g. turbo/06) it sends a TURBO_ST...
New
New
jskubick
I think I might have found a problem involving SwitchCompat, thumbTint, and trackTint. As entered, the SwitchCompat changes color to hol...
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
imeraj
xdif/server.ex code from book does not work with the XDig client from the book. I noticed inside handle_info call, it’s not sending the ...
New

Other popular topics Top

AstonJ
I’ve been hearing quite a lot of comments relating to the sound of a keyboard, with one of the most desirable of these called ‘thock’, he...
New
PragmaticBookshelf
Rust is an exciting new programming language combining the power of C with memory safety, fearless concurrency, and productivity boosters...
New
AstonJ
This looks like a stunning keycap set :orange_heart: A LEGENDARY KEYBOARD LIVES ON When you bought an Apple Macintosh computer in the e...
New
Exadra37
I am asking for any distro that only has the bare-bones to be able to get a shell in the server and then just install the packages as we ...
New
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
gagan7995
API 4 Path: /user/following/ Method: GET Description: Returns the list of all names of people whom the user follows Response [ { ...
New
husaindevelop
Inside our android webview app, we are trying to paste the copied content from another app eg (notes) using navigator.clipboard.readtext ...
New
AstonJ
If you’re getting errors like this: psql: error: connection to server on socket “/tmp/.s.PGSQL.5432” failed: No such file or directory ...
New
AstonJ
This is a very quick guide, you just need to: Download LM Studio: https://lmstudio.ai/ Click on search Type DeepSeek, then select the o...
New

Sub Categories: