[ACCEPTED]-Is the format of the data held in kotlin.MetaData documented anywhere?-kotlin
kotlin.Metadata contains information about Kotlin symbols, such 27 as their names, signatures, relations between 26 types, etc. Some of this information is 25 already present in the JVM signatures in 24 the class files, but a lot is not, since 23 there's quite a few Kotlin-specific things 22 which JVM class files cannot represent properly: type 21 nullability, mutable/read-only collection 20 interfaces, declaration-site variance, and 19 others.
No specific actions were taken to 18 make the schema of the data encoded in this 17 annotation public, because for most users 16 such data is needed to introspect a program 15 at runtime, and the Kotlin reflection library provides a nice API 14 for that.
If you need to inspect Kotlin-specific 13 stuff which is not exposed via the reflection 12 API, or you're just generally curious what 11 else is stored in that annotation, you can 10 take a look at the implementation of kotlinx.reflect.lite. It's 9 a light-weight library, the core of which 8 is the protobuf-generated schema parser. There's 7 not much supported there at the moment, but 6 there are schemas available which you can use to 5 read any other data you need.
UPD (August 4 2018): since this was answered, we've published 3 a new (experimental and unstable) library, which 2 is designed to be the intended way for reading 1 and modifying the metadata: https://discuss.kotlinlang.org/t/announcing-kotlinx-metadata-jvm-library-for-reading-modifying-metadata-of-kotlin-jvm-class-files/7980
More Related questions