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

yulkin
your book suggests to use Image.toByteData() to convert image to bytes, however I get the following error: "the getter ‘toByteData’ isn’t...
New
mikecargal
Title: Hands-On Rust (Chap 8 (Adding a Heads Up Display) It looks like ​.with_simple_console_no_bg​(SCREEN_WIDTH*2, SCREEN_HEIGHT*2...
New
herminiotorres
Hi @Margaret , On page VII the book tells us the example and snippets will be all using Elixir version 1.11 But on page 3 almost the en...
New
HarryDeveloper
Hi @venkats, It has been mentioned in the description of ‘Supervisory Job’ title that 2 things as mentioned below result in the same eff...
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
cro
I am working on the “Your Turn” for chapter one and building out the restart button talked about on page 27. It recommends looking into ...
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
curtosis
Running mix deps.get in the sensor_hub directory fails with the following error: ** (Mix) No SSH public keys found in ~/.ssh. An ssh aut...
New
taguniversalmachine
Hi, I am getting an error I cannot figure out on my test. I have what I think is the exact code from the book, other than I changed “us...
New
roadbike
From page 13: On Python 3.7, you can install the libraries with pip by running these commands inside a Python venv using Visual Studio ...
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
AstonJ
What chair do you have while working… and why? Is there a ‘best’ type of chair or working position for developers?
New
AstonJ
Thanks to @foxtrottwist’s and @Tomas’s posts in this thread: Poll: Which code editor do you use? I bought Onivim! :nerd_face: https://on...
New
Rainer
Not sure if following fits exactly this thread, or if we should have a hobby thread… For many years I’m designing and building model air...
New
PragmaticBookshelf
“A Mystical Experience” Hero’s Journey with Paolo Perrotta @nusco Ever wonder how authoring books compares to writing articles?...
New
gagan7995
API 4 Path: /user/following/ Method: GET Description: Returns the list of all names of people whom the user follows Response [ { ...
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
PragmaticBookshelf
Author Spotlight Rebecca Skinner @RebeccaSkinner Welcome to our latest author spotlight, where we sit down with Rebecca Skinner, auth...
New
DevotionGeo
I have always used antique keyboards like Cherry MX 1800 or Cherry MX 8100 and almost always have modified the switches in some way, like...
New
sir.laksmana_wenk
I’m able to do the “artistic” part of game-development; character designing/modeling, music, environment modeling, etc. However, I don’t...
New

Sub Categories: