again! <https://kotlinlang.slack.com/archives/C0B8...
# intellij
f
again! https://kotlinlang.slack.com/archives/C0B8H786P/p1669205543114769 Anyone knows how to get to the actual source-code when this happens? I've tried clearing all caches and reindexing; restarted multiple times. download sources does not work/update. I've also tried removing the downloaded sources (211K) from my local m2-repository and built the project again. this is the latest release IntelliJ IDEA 2022.3 (Ultimate Edition) Build #IU-223.7571.182, built on November 29, 2022 Kotlin: 223-1.7.20-release-201-IJ7571.182
for some reason when I try to navigate to
subList
it actually finds the interface/source-code:
image.png
for instance I can view the implementation of
MapBuilder
and
ListBuilder
when navigating to the stdlib, but not
ListBuilderKt
,
AbstractMap
or
CollectionsKt
d
This happened to me as well, what's worse is that the quick documentation is also gone
So I can't see the javadoc
f
yupp
I've been trying everything (clear/rebuild/repair/reload/different versions/explicit dependencies top all std-lib-files/downgrading kotlin to same version as IDEA) now for 2 hours without any luck
my best guess is that there are a number of sourcefiles for stdlib, and only one contains the actual source-file for any given implementation, and then the wrong is picked any impossible to override/change:
Copy code
╰  $ find kotlin-stdlib* | grep 1.7.21 | grep "sources.jar$"
kotlin-stdlib/1.7.21/kotlin-stdlib-1.7.21-sources.jar
kotlin-stdlib-common/1.7.21/kotlin-stdlib-common-1.7.21-sources.jar
kotlin-stdlib-jdk7/1.7.21/kotlin-stdlib-jdk7-1.7.21-sources.jar
kotlin-stdlib-jdk8/1.7.21/kotlin-stdlib-jdk8-1.7.21-sources.jar
from my local mvn .m2-repo ^^
a
I find this regularly happens with Kotlin Multiplatform projects. With JVM-only projects it happens much more rarely.
a
Do you mean that it happens on “Go to declaration” from the editor? Does it reproduce in a new project? Can you please create a YouTrack issue with a project to reproduce?
f
@Alexey Belkov [JB] yes, on "Go to declaration". No, sorry - not able to reproduce. After spending 3 hours on this the other day, then leaving my computer and coming back it worked. But both stackoverflow and this channel has mentioned this on multiple occasions, and it's really frustrating when it happens, so I hope you look into it somehow. I've had this happen to me many times, on many different versions of intellij. Could it be the different sources.jar above - and intllij picking the wrong one and not being able to resolve the src-file if the src-file is not in the actual source.jar? some other "instances": https://kotlinlang.slack.com/archives/C0B8H786P/p1669205543114769 https://stackoverflow.com/questions/49311545/how-to-see-kotlin-stdlib-source-code-in-intellij https://stackoverflow.com/questions/62374225/how-to-load-sources-of-a-kotlin-compiler-kotlin-compiler-embeddable-in-idea https://stackoverflow.com/questions/67601732/where-is-some-methods-implemented-in-the-kotlin-source-code https://youtrack.jetbrains.com/issue/KTIJ-11995 https://youtrack.jetbrains.com/issue/KTIJ-912
a
Maybe. I think it should help to delete .idea folder in such cases, because then Idea will regenerate the project model, including library paths. It may also help to clean home/.gradle or .m2 caches, in case there is a broken jar there.
f
ok - I've cleaned the file cache multiple times. will try to manually delete the idea-folder next. (which is fine for small projects, but my main day-to-day project consists of 50 different modules, so it kind of s*** to delete the project)
a
Note that there is a well-known common problem when opening library files from Project view: https://youtrack.jetbrains.com/issue/KTIJ-912/Sources-are-not-displayed-for-file-facades-JvmName-opened-from-Project-View. But in “Go to declarations” it should generally work.
f
thx for the pointer to the issue - might be the same issue for me - even though my main navigation is "go to declaration" - I don't think I've browsed from project view until trying to debug this issue the other day.
btw @Alexey Belkov [JB] - as stated in the issue "search everywhere" does indeed find both the class-variant and the actual source-variant for me. But this is really slow compared to "go to declaration" and also - it's not obious which one to pick, so you end up trying multiple.
n
I reported the same problem here https://kotlinlang.slack.com/archives/C0B8H786P/p1669205543114769 @Alexey Belkov [JB] here is how to reproduce. 1. go to start.spring.io 2. generate a new project selecting Maven and Kotlin 3. open the project in Idea add
mapOf("" to "").mapNotNull {  }
4. and do CMD+B on mapNotNull
🙏 1
a
🙏 1
f
🙏 @Alexey Belkov [JB]!
❤️
❤️ 2
e
This seems to be fixed for the JVM side, right? However, see https://kotlinlang.slack.com/archives/C0B8L3U69/p1687163151423089 for the JS side