I am facing the issue that IntelliJ doesn't let me...
# getting-started
p
I am facing the issue that IntelliJ doesn't let me use
mutableListOf
inside of
commonMain
. I can use it in every other directory (
commonTest
,
nativeMain
and
nativeTest
). I have reinstalled the IDE, the Kotlin plugin, disabled all other plugins, tried the EAP and created multiple new projects to test this, and it is always the same issue. Here is a video showing that this doesn't work in `commonMain`:
Also here is a screenshot that shows a popup telling me that
mutableListOf
will not be available in
commonMain
when copying this test class to `commonMain`:
Oh man, this is so frustrating... it's actually a deal-breaker -.-
t
You shouldn’t use the package names you are using:
src/org/example/app
should be the “main” package of your application / code. Btw. tests are not in the
src
module, instead one typically has a
test
module with the same package structure like your
src
:
test/org/example/app
I woul dassume Intellij is not working properly, since you are having a package named
*main
which might collide with some internal logic of intellij.
p
This is an auto generated kotlin native project @Timo Gruen
Also sometimes when i open intellij, it finds
mutableListOf
in
commonMain
and then when i restart it, it doesn't find it again. Its completely random, idk.
t
Ahhh in that case just ignore me. Never worked with kotlin native yet. Assumed you tried to run JVM Kotlin
You already tried to refresh the cache? Helped me plenty of times in the past with IntelliJ
p
Yes, i also tried re-installing the IDE and plugins and creating new fresh projects, always the same random result.
If anyone stumbles over this, i am convinced this is a but with IntelliJ or the Kotlin plugin, and i opened an issue for it: https://youtrack.jetbrains.com/issue/IDEA-270688