What is an "associated object" in Kotlin, and what...
# codereview
m
What is an "associated object" in Kotlin, and what is its use cases? I found it by chance, and besides understand how the methods work - I'm not sure what is the use case for it. For reference: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.reflect/find-associated-object.html
e
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.reflect.full/companion-object.html and https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.reflect/-k-class/object-instance.html are JVM-only; Kotlin/JS and Kotlin/Native don't have the same runtime reflection capabilities so they need this extra support
m
Oh, very interesting. Thank you!