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

**URL:** <https://discuss.kotlinlang.org/t/announcing-kotlinx-metadata-jvm-library-for-reading-modifying-metadata-of-kotlin-jvm-class-files/7980>\
**Category:** Libraries\
**Created:** [June 1, 2018, 5:27pm UTC](https://discuss.kotlinlang.org/t/announcing-kotlinx-metadata-jvm-library-for-reading-modifying-metadata-of-kotlin-jvm-class-files/7980 "2018-06-01T17:27:31Z")\
**Posts on this page:** 1\
**Showing post:** 37

<div class="post-metadata">

**Author:** ![udalov](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/udalov/32/5679_2.png) [@udalov](https://discuss.kotlinlang.org/u/udalov)\
**Post date:** [October 15, 2020, 4:04pm UTC](https://discuss.kotlinlang.org/t/announcing-kotlinx-metadata-jvm-library-for-reading-modifying-metadata-of-kotlin-jvm-class-files/7980/37 "2020-10-15T16:04:13Z")

</div>

kotlinx-metadata-jvm [0.2.0](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-metadata-jvm/0.2.0/jar) has been released.

The major breaking change in this release is that it no longer supports _writing_ class metadata of versions earlier than 1.4. Reading metadata of old format will continue working fine, but writing it had a complicated [issue](https://youtrack.jetbrains.com/issue/KT-41011) that could result in compilation errors in dependent code, so it was decided to report an error if metadata version is less than 1.4. You can still use older kotlinx-metadata-jvm versions for writing pre-1.4 class files, however please read the mentioned issue and beware of the fact that older versions also suffered from it.

Other than that, this release finally brings the full support of metadata produced by Kotlin 1.4 by adding a new flag for fun interfaces, and the new metadata for optional annotation classes in multiplatform projects.

Full changelog:

- [`KT-41011`](https://youtrack.jetbrains.com/issue/KT-41011) Using KotlinClassMetadata.Class.Writer with metadata version \< 1.4 will write incorrect version requirement table
  - Breaking change: `KotlinClassMetadata.*.Writer.write` throws exception on `metadataVersion` earlier than 1.4.0.  
Note: metadata of version 1.4 is readable by Kotlin compiler/reflection of versions 1.3 and later.

- Breaking change: `KotlinClassMetadata.*.Writer.write` no longer accept `bytecodeVersion`.
- [`KT-42429`](https://youtrack.jetbrains.com/issue/KT-42429) Wrong interpretation of Flag.Constructor.IS\_PRIMARY
  - Breaking change: `Flag.Constructor.IS_PRIMARY` is deprecated, use `Flag.Constructor.IS_SECONDARY` instead

- [`KT-37421`](https://youtrack.jetbrains.com/issue/KT-37421) Add `Flag.Class.IS_FUN` for functional interfaces
- Add `KmModule.optionalAnnotationClasses` for the new scheme of compilation of OptionalExpectation annotations in multiplatform projects ([KT-38652](https://youtrack.jetbrains.com/issue/KT-38652))

---

_[View the full topic](https://discuss.kotlinlang.org/t/announcing-kotlinx-metadata-jvm-library-for-reading-modifying-metadata-of-kotlin-jvm-class-files/7980)._
