Why is Kotlin keeping MetaData in Kotlin class file?
Certain aspects of Kotlin code cannot be expressed in pure Java bytecode (e.g. nullability, primary constructors, internal
visibility, modifier lateinit
, property delegation, etc.). Instead, they are serialized and stored as metadata in the classes.
When you use a JAR distribution of a Kotlin library, the compiler parses the metadata to discover these specific Kotlin attributes in order to use the library as a Kotlin artifact with all the available functionality.
At runtime, the metadata is used by the kotlin-reflect
Kotlin reflection API to restore these attributes and make them available through reflection.
source to share