Kotlin / kotlinx.serialization

Kotlin multiplatform / multi-format serialization
Apache License 2.0
5.23k stars 615 forks source link

[contributing] Completion error in intellij after 2.0.0-RC3 #2725

Open Chuckame opened 2 weeks ago

Chuckame commented 2 weeks ago

Describe the bug Since kotlinx.serialization 1.7.0, I'm unable to contribute as all the kotlin standard library is missing the completion, and/or have the standard library missing from the classpath, which makes all the listOf, apply, to and more to be red. No issue when going back to 1.6.3. I don't know if it's a misconfiguration of the library or my computer, but this is the only project having issues (regarding 10-15 other projects), that's why I'm opening the issue here.

I tried everything, even reinstalling intellij, emptying gradle's cache, remove shared indexes, etc. Also tried with multiple Java runtimes from 17 to 21.

Do you already had this issue?

To Reproduce Just checkout 1.7.0 or master.

Environment

sandwwraith commented 2 weeks ago

Do you mean that when you open the kotlinx.serializaition project itself, you can't get indexing/completion? I haven't experienced such problems, so it may be indeed related to your configuration. See this ticket, maybe you have similar problem: https://github.com/Kotlin/kotlinx.serialization/issues/2673

Chuckame commented 2 weeks ago

I've totally removed the lib folder and re-cloned it, after removing the system directory, enabled K2 mode, re-imported the root build.gradle.kts. Still the same, all the standard libraries are not found by IntelliJ 😞 All the rest is working (indexing/completion)

sandwwraith commented 2 weeks ago

You shouldn't enable K2 mode in IDE, it doesn't support MPP projects for now. Regular mode works fine with Kotlin 2.0 projects

Chuckame commented 2 weeks ago

Ok, same without K2 mode.

But there is something strange: Annotation class is indexed, but it's from a decompiled kotlin class and not sources, I never had this.

image

Here are the errors I'm getting:

image image
sandwwraith commented 2 weeks ago

Unfortunately, I'm not able to reproduce the problem even on a freshly cloned project :( Does building from command line (e.g. ./gradlew jvmTest) works correctly? Maybe you have some weird environment variables?

Chuckame commented 2 weeks ago

Yes, gradle compiles well and execute well the tests

$ kotlinx.serialization % ./gradlew jvmTest
[.....]
BUILD SUCCESSFUL in 49s

AFAIK, no weird env var, the only changed config is -Xmx3072m.

All my other projects are working well 😅

sandwwraith commented 2 weeks ago

To be honest, I don't know what else to recommend to you except trying to take your colleague's computer and/or VM and see what happens there :(

xiaozhikang0916 commented 2 weeks ago

Did you try install another instance of intellij via JetBrains Toolbox, or other version like 2024.2 EAP, or clean all IDE cache by removing directory in ~/Library/Caches/JetBrains/{IDE_VERSION} (in mac) ?

Chuckame commented 1 week ago

@xiaozhikang0916 yes I already cleaned this folder (that is the system directory) and also already cleaned all the caches.

Today I tried with a brand new clean IDE (IntelliJ community), but still having the same issue: all the standard library is not found by the IDE

Chuckame commented 1 week ago

Ok, I've tested all the commits on the fresh IntelliJ. The error appears when moving from kotlin 2.0.0-RC3 to 2.0.0, commit d2dc7d2978bd62971e8ab00de197d59d7e378ed2, tag v1.7.0.

Chuckame commented 1 week ago

It works when using Kotlin 2.0.20-Beta1