I've noticed a while ago that in some cases I can'...
# announcements
a
I've noticed a while ago that in some cases I can't see the source code (only some generated/decompiled) code when I try to look at Koltin classes. For example the source of
Channel
looks like this when I Ctrl + Click on it:
Copy code
public interface Channel<E> : kotlinx.coroutines.channels.SendChannel<E>, kotlinx.coroutines.channels.ReceiveChannel<E> {
    public companion object Factory {
        public const final val BUFFERED: <http://kotlin.Int|kotlin.Int> /* compiled code */

        internal final val CHANNEL_DEFAULT_CAPACITY: <http://kotlin.Int|kotlin.Int> /* compiled code */

        public const final val CONFLATED: <http://kotlin.Int|kotlin.Int> /* compiled code */

        public const final val DEFAULT_BUFFER_PROPERTY_NAME: kotlin.String /* compiled code */

        internal const final val OPTIONAL_CHANNEL: <http://kotlin.Int|kotlin.Int> /* compiled code */

        public const final val RENDEZVOUS: <http://kotlin.Int|kotlin.Int> /* compiled code */

        public const final val UNLIMITED: <http://kotlin.Int|kotlin.Int> /* compiled code */
    }
}
What can I do to fix this and see the source (IDEA says that this file is called
Channel.kotlin_metadata
)?
sources aren’t shipped with dependency jars by default most of the time, but thankfully the coroutines library is all open source and available on GitHub
a
i don't want to read the sources online
i'm used to reading the source with ctrl+click
⬆️ 3
can i attach the sources somehow?
this is a great step back for me 😞
r
I can see the sources of the
Channel
class without problems in my project. I haven't configured anything.
Perhaps try to re-import your project.
a
how did you add the dependency?
is your project a multiplatform one?
I have this:
org.jetbrains.kotlinx:kotlinx-coroutines-core-common
r
multiplatform
I have this in the common source set
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion")
a
so i shouldn't use
common
?
r
i think not, just the name without any suffixes only in the common source set
a
i'll try, thanks
still the same
i'll try to reimport
i have the same problem with the stdlib as well
n
I’ve ran into this issue too 😞. I think i had to invalidate caches to get it to work. Instead of doing that first, try downloading a canary version of your IDE and see if that fixes the issue?
a
oh
i'll try the invalidation
n
did that fix it?
a
no 😞
c
I was looking into a fix for this today as well. I found something online saying to delete my local maven repo, but no luck.
Mine was is for the stdlib, as you mentioned
a
this only happens with common projects btw
JVM is fine
c
Right, for me it’s only the Kotlin stdlib.
a
i'm gonna open an issue in IDEA's issue tracker
this is a horrible limitation
c
Nice, would you link the ticket here, if you don’t mind?
tbh, I’ve stopped looking in how to fix this for myself, I gave up after an hour and just grep github for the code 😢
a
yep
it seems random btw
sometimes i see the source sometimes i don't
i don't get it
so for example now I see
Channel
properly, but I don't see the implementations from the stdlib anymore 😄
c
Haha. Fwiw it’s never worked for me 😞
a
it seems random
another insane thing just started to happen 😂
😄 1
i'm gonna craete a video of it
oh, can't
invalidate caches solved it
c
🤔 not sure if that’s good or bad haha
a
what happened is i typed a
.
after an object reference
suggestions popped up then there was a progress indicator at the bottom about indexing
then the dialog went away
without me interacting with it
c
oh weird. so your cache was in a bad state or something?
a
seems so
i also had to do a "refresh gradle dependencies" 2 times
😬 1
right now what happens is if i run
./gradlew clean build
from the internal terminal i have to refresh gradle dependencies again because IDEA "forgets" where my packages come from
all those red compilation errors get fixed once i click refresh gradle dependencies
i don't know what's going on...
c
Odd, I’ve not seen anything like that before
a
me neither
this all happened after i refactored my project to use kotlin 1.4.10
it compiles properly but also makes IDEA mad
c
Oh interesting, I was about to try and upgrade a project to that today, but something else came up 🙂
Still on 1.3.x for said project
a
hehe
now you know what you're looking forward to 😂
😅 1
i made a video of it
i'm uploading it now
blows my mind

https://www.youtube.com/watch?v=6ES2ug0fej8&amp;ab_channel=theArgonautics

sorry for the music
i just realized this records audio as well
this shows that i build the project from terminal it breaks the imports somehow
but if i refresh the gradle deps they are fixed
i think i might need to reinstall this
i get the weird popup disappearing again
c
very odd
Someone responded on your ticket, saying to try
Invalidate Caches and Restart
. This worked for me 🎉
a
I did that twice 😞
c
Yeah, I had a feeling you did haha. You mentioned that fixed a diff issue you started having.
dang, bummer man. hopefully it gets sorted
a
it is not a big deal
thanks for the heads up 👍
🙌 1
c
It’s still a bit annoying hehe
a
maybe restarting my computer will help 😄
🙂 1
n
I just ran into this issue. Switching from android studio 4.2 to 4.1 fixed it.
c
@Nick Adam left a comment on the YouTrack ticket above, that fixed it for him. For me, I just had to Invalidate Caches and Restart
a
we'll see tomorrow if it is still ok
🙏 1