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

kotlinx-metadata-jvm 0.2.0 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 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 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 Wrong interpretation of Flag.Constructor.IS_PRIMARY
    • Breaking change: Flag.Constructor.IS_PRIMARY is deprecated, use Flag.Constructor.IS_SECONDARY instead
  • 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)
1 Like