kotlin-hands-on / hands-on

Apache License 2.0
130 stars 176 forks source link

"Cannot access class" error in IntelliJ 2022.1.3 #177

Closed craigotis closed 2 years ago

craigotis commented 2 years ago

Following the hands-on project to Step 3 ("A simple API server"), making use of the call variable seems to cause issues with IntelliJ:

Cannot access class 'io.ktor.util.pipeline.PipelineContext'. Check your module classpath for missing or conflicting dependencies
Screen Shot 2022-07-14 at 9 06 33 AM

Oddly, io.ktor:ktor-utils:2.0.3 is listed in my module classpath:

Screen Shot 2022-07-14 at 9 16 46 AM

This is the only project in which I'm experiencing issues, but it could be an IntelliJ issue (not specific to this project) based on the fact that the application/server does build successfully on the CLI, and starts successfully.

I've gone through all the usual steps - making sure the IDE/plugins were up-to-date, re-importing a freshly cloned project, force-syncing the Gradle import, and even uninstalling/reinstalling the Kotlin and Ktor plugins in IntelliJ.

SebastianAigner commented 2 years ago

@craigotis Thanks for the report, Craig. This is a known problem with multiplatform dependencies that I've actually brought up to the team again just yesterday (https://youtrack.jetbrains.com/issue/KT-52216, https://youtrack.jetbrains.com/issue/KT-49877/). Fix for this false positive behaviour in IntelliJ IDEA is expected with Kotlin 1.7.20.

Your program should still compile and run fine – AFAIK, this is just an IDE error.

craigotis commented 2 years ago

@SebastianAigner Wow, speedy response, and glad it was already on your radar - neither of those KT tickets came up in my searching. I'll keep an eye on them, and close this one out!

Thank you!