why is there a `kotlin.collections.LinkedHashSet` ...
# announcements
c
why is there a
kotlin.collections.LinkedHashSet
typealias that aliases to
java.util.LinkedHashSet
(in typealiases.kt) , but also a kotlin class
kotlin.collections.LinkedHashSet
defined in
LinkedHashSet.kt
?
e
are you aware of how `expect`/`actual` works in kotlin multiplatform? https://kotlinlang.org/docs/reference/mpp-connect-to-apis.html
libraries/stdlib/common/.../LinkedHashSet.kt:
Copy code
expect class LinkedHashSet<E>
libraries/stdlib/jvm/src/kotlin/collections/TypeAliases.kt:
Copy code
public actual typealias LinkedHashSet<E> = java.util.LinkedHashSet<E>
libraries/stdlib/wasm/src/kotlin/collections/LinkedHashSet.kt:
Copy code
actual open class LinkedHashSet<E>
(ditto libraries/stdlib/js... etc)
this lets common code use LinkedHashSet; it will be replaced with the typealias on JVM and with a Kotlin implementation on other platforms
c
ok so when idea navigates to the pure kotlin version in my jvm project thats an idea bug?
e
which one does it navigate to?
c
the one in common
but not always, now it navigates to the alias
e
that would be correct, both common expect and jvm actual define what you can use on jvm
c
ah ok it makes sense. I missed that the LinkedHashSet in common is just an expect
thanks for your explanation!