I have the weirdest bug (maybe in my project, or i...
# intellij
l
I have the weirdest bug (maybe in my project, or in IDEA, or in Kotlin). It's a multiplatform Kotlin project which loads and builds fine in IDEA with Kotlin 2.0.0-RC3. However, if I switch to Kotlin 2.0.0, then all Kotlin library classes in the "common" directory (such as
ArrayList
, or
IllegalStateException
, etc) will be red with the IDE saying that the class cannot be found. The same standard library classes references in the platform-specific directories (such as "jvm" and "linux") works fine. If I switch back to Kotlin 2.0.0-RC3, the problem goes away. The really weird thing is that this is what happens when I load the project on a new system (or after clearing the IDEA cache). I have two machines where this problem didn't occur. So I deleted the cache and config on it and reloaded the project and now it also exhibits this problem. This suggests to me that this is a problem with IDEA. But, I will never rule out operator error. The project where this happens in open source by the way, so if anyone wants to test, they can find the code here: https://codeberg.org/loke/array Any idea how to figure this one out?
c
Do you use Dokkatoo?
l
No, I don't think so. I don't know what it is (searching) ah, it's a document generator. No, I don't use that.
c
I don't know what it is then 😕 If you can reproduce it on a smaller project, please create an issue: https://kotl.in/issue
l
This is what I see when I switch to Kotlin 2.0.0 (without RC3):
@CLOVIS thanks. I've been trying to narrow it down, but so far have been unsuccessful. I'll try to make a smaller project of course, but it's a lot of work so I'm considering waiting until 2.0.1 and if the issue remains, then I can try again.
c
You're the first one I see having this kind of issues, so I don't think it's a known issue 😕
l
The machines I tried this one were all Fedora 40 machines. The Fedora 39 machine still loads the project perfectly (although, I haven't cleared the configuration or cache on that one yet 🙂 ).
And... It's getting stranger and stranger. I wondered if the problem was fixed by a change in Kotlin versions, so I changed the code to use RC3, then cleared all caches and generated IDEA files and reloaded. Now I had the error (lots of red in my files). I then changed to 2.0.0, and the problem remained. I then changed to RC2, and the problem still remained.
I will now try again, starting with "2.0.0", clear everything and downgrade to RC3 to see if the original described behaviour returns.
This is really strange. I can't get it working in any way anymore, no matter what Kotlin version I try. If anyone is able to try to load the project on their system I'd really appreciate it.
c
If you suspect it's a system-dependent thing, try to run your project in a container made for CI, for example mine:
<http://registry.gitlab.com/opensavvy/automation/containers/java|registry.gitlab.com/opensavvy/automation/containers/java>
(sources) It can build and run projects for
jvm()
and
linuxX64()
(there are other containers in the repo for
js(IR)
if you need)
l
@CLOVIS The project itself builds and runs correctly. It's only when it's loaded into IDEA thew error occurs.
I'm going to try in a virtual machine running Fedora 39 next.