Hi everyone,
Is it possible to get the Companion Object instance from a given KClass without using Kotlin-Reflect-Full?
I know this is possible using Kotlin-Reflect-Full with the following method: companionObjectInstance. However, this Kotlin-Reflect-Full is a big library and I would like to avoid to add it to my app - I’m an Android Developer.
Another option I found is using AssociatedObjectKey
+ findAssociatedObject
but this means that I would need to manually add this annotation with a reference to the companion object every time I want to do this… For more details about this approach, check here: findAssociatedObject - Kotlin Programming Language
Is there any other alternative? It would be super nice if it would be possible to get a companion instance without relying on Kotlin-Reflect-Full.
Thank you very much.