You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Vladimir Mutafov edited this page Sep 12, 2019
·
2 revisions
Internals of the Kotlin support in the NS Android Runtime
Metadata Generator
Understanding a .class file represents a Kotlin class/file
The process of understanding a .class file originally contained Kotlin code depends strongly on the @kotlin.Metadata annotation. This annotation is written by the Kotlin compiler into every .class file. It provides information about all language features which do not have a Java or bytecode analog. Example of such features are Kotlin properties, objects, data classes, and others. This information is stored in a protobuff serialized way and is used by Kotlin's internal runtime classes supporting reflection, type reification and other Kotlin features.
We use the @kotlin.Metadata annotation for several purposes: knowing a get/set method was originally a Kotlin property and knowing if a nested class was originally a companion object in Kotlin. Having the information from the annotation also enables supporting specific syntactic sugars for using Kotlin in NativeScript apps.
Reading this annotation is done using the kotlinx-metadata-jvm library by JetBrains.