Announcing kotlinx-metadata-jvm library for reading/modifying metadata of Kotlin/JVM class files

No, annotations are not stored in the metadata and kotlinx-metadata-jvm doesn’t provide a way to read them. The only workaround is to read them directly by external means, such as from the bytecode, via reflection or annotation processing API. File annotations specifically are generated on the corresponding file facade class, if it exists.

We do plan to provide access to annotations on classes and members (see the comment above and KT-31857), but likely not as a part of the core kotilnx-metadata-jvm library.

1 Like