I have the weirdest problem. I'll try to explain i...
# intellij
l
I have the weirdest problem. I'll try to explain it briefly: I have a multi-module multiplatform project. In one of the modules, IDEA shows the code in the
commonTest
module as not being found. I.e. all classes/functions/etc that reference something outside the module shows up as red. This includes references to classes in other modules that it depends on, and also other dependencies (specifically,
kotlin.test.Test
. And here's the really weird thing: It only happens on this one machine (running Arch linux). On Fedora machine and a Windows machine it all works fine. All other modules work as well. This only happens in
commonTest
in one specific module. Classes in
jsText
,
jvmTest
and
linuxTest
works fine, as does
commonTest
in other modules. I have does a full invalidate chaches and restart. I even manually deleted all the IDEA files (everything in
$HOME/.cache.JetBrains
) and all the generated project files and reloaded everything, but the problem remains. Does anyone have any suggestion what to check? Oh, and one more thing: Actually running the tests form gradle works fine.
t
Hi Elias! Could you let us know which version of IntelliJ IDEA you’re using and whether K2 mode is enabled? This will help us reproduce the issue.
l
It's
Build #IU-251.23536.34
.
Thanks by the way.
I was desperately trying different things, and I finally managed to get it to work just now. I was messing around with changing the dependencies, and nothing worked. Then I changed it back and clicked on the little gradle reload button and all of a sudden the red warnings disappeared.
gradle intensifies 1
So now I have exactly the same code, but the errors disappeared. So it would appear that deleting all the idea project files as well as the cache doesn't actually delete everything?
I had spent hours trying to fix this. I'm going to try to delete everything again to see what happens.
👀 1
t
all the generated project files
Do you mean you also cleaned your build and then built the project again?
l
Yes, I deleted the
.idea
directory in the root of the project, as well as all the cache files in
$HOME/.cache/JetBrains
. I also deleted
$HOME/.gradle
.
@Teodor Irkhin I was working on my project today, and all of a sudden the same thing happened on a different machine. It's in the exact same state right now. I've tried everything I did on my laptop last time, but it won't go away. Is there anything I can test right now that would help finding a way to reproduce?
t
If possible, could you please provide a project to reproduce the problem? As it has some strange behavior with Arch Linux, which makes it difficult to reproduce from the current description. Or if the project you are working on is open source, you can just give a link to it.
l
I'm testing on Fedora now.
And I took the code, put it in a separate directory and did a full import. Problem remained.
I'll give you the code:
🙏 1
Here's the project. The branch is `ride-impl`: https://codeberg.org/loke/array/src/branch/ride-impl
All I'm doing is importing the project, and open a file in
commonTest
. For example:
array/src/commonTest/kotlin/com/dhsdevelopments/kap/CustomCommandsTest.kt
.
@Teodor Irkhin I'm looking at the project settings (control-shift-S) and it seems the dependencies were not picked up correctly.
This is on
Build #IU-251.23536.34
.
This is really bizarre. I downgraded IDEA and the problem persists.
I checked out an older version of the code, which I know worked. And the same problem.
🤔 1
I created a bug report: IDEA-368493
thank you color 1
t
Could you check, if K2 mode enabled?
l
@Teodor Irkhin I tried with both K2 and K1.
Here is an example what it looks like by the way:
@Teodor Irkhin I also updated the bug report with more details.
thank you color 1
@Teodor Irkhin Another update: I really needed to get things working on my Fedora machine, so I tried to fix it: • I added
test-tools
as a dependency to
array/commonMain
the problem disappeared. • I then removed that dependency again, and the problem did not reappear. • I did a full delete cache and restart. The problem did not reappear. • I brought out my Arch laptop and pulled the latest changes so the code was identical to what I had on the Fedora machine. • The problem showed up again on my Arch laptop. • I added
test-tools
as a dependency to
array/commonMain
on the Arch laptop, the problem disappeared. • I removed the dependency (i.e. restoring the change made above), and I still don't see the problem. • Once the problem disappeared, I checked the project settings and
commonTest
now has the correct dependecies. So in summary: When the problem appears, it persists even though I delete all caches and all gradle state, and reparse the configuration. I can make it go away by adding
test-tools
as a dependency to
comonMain
and then remove it again. Clearly the problem persists somewhere other than the cache files. So the next step for me is to find out where the state is stored. Where else could it be stored? I'd like to copy all those files, then remove the issue by changing the dependency again and compare the files to see what's different.
Hmm, did the bug id change? Now it's KTIJ-33328.
I added my above comment to the issue.
t
Yes, I’ve moved it to Kotlin IntelliJ Plugin space as this is a more suitable place for it
l
Thanks