Anyone else’s IDE won’t import `kotlinx.serializat...
# intellij
r
Anyone else’s IDE won’t import
kotlinx.serialization.Serializable
or is it just me? When I type
@Serializable
and autocomplete it it writes
@kotlinx.serialization.Serializable
instead of importing it. Doesn’t do it for any other class/annotation. Then if I try to hit
Alt+Enter
on it, it doesn’t offer to add the import there either. Weird
m
Maybe you have accidentally added it to ignored symbols? It happened to me cupule of times, it's easy to miss click this option
r
Ignored symbols? Is that a thing? I never head of that, where can you find a list of ignored symbols?
c
In IntelliJ settings: Editor > General > Auto Import, the section “Exclude from auto-import and completion”
r
Damn, hoped it was that. That list is empty for me
But thanks
c
np. interestingly, not having kotlinx.serialization in this project (will try another one that has it shortly), taking an existing Kotlin class and having it implement
java.io.Serializable
results in similar behaviour
: java.io.Serializable
, though Alt-Enter does allow it to be imported. Doing the same for
AutoCloseable
(java.lang) or `InputStream`(java.io, same as Serializable) automatically does the imported version. Would seem to indicate that
Serializable
is somehow special.
r
Interesting. I’m working mostly in common and native sourcesets recently so it’s not specifically related to a platform either
c
kotlinx.serialization.Serializable
- on initial use it pulls in as fully qualfied, but I do have the option (Alt-Enter) to import. However, if I’ve already imported
javax.io.Serializable
, there is no option to import the kotlinx annotation. fwiw these tests are Gradle Kotlin DSL plugins (published Kotlin projects).
if you do have both, one could be imported using an import alias, though I try to stay away from those (the inevitable “Hey, what is this magical type being used?” from your future self).
r
Well
javax
isn’t a thing on iOS so it’s unrelated
c
apologies. unfortunate typo. s/b
java.io.Serializable
.
r
java
isn’t either 😄 It also happens in common code and in an empty file with just a data class, like the first and only import added should be
kotlinx.serialization.Serializable
and it does that instead
r
Yep, looks like it. But it says fixed in 221-1.6.10-release-IJ4153 and I’m on 221-1.6.20-release-285-IJ5080.210 so I guess it isn’t
c
perhaps try invalidating caches & restarting, find that is necessary at times to clean up quirky behaviour.
z
I have the same problem, but for me it is with
kotlinx.serialization.*
,
io.ktor.*
kotlinx.coroutines.*
and two internal MPP libraries. Invalidating caches does not work, deleting the folders don't work too.
The strange thing is it worked just fine 2 hours ago.