Reads and parses the given annotation data of a Kotlin JVM class file and returns the correct type of KotlinClassMetadata encoded by this annotation, if metadata version is supported.

annotationData may be obtained reflectively, constructed manually or with helper kotlinx.metadata.jvm.Metadata function, or equivalent KotlinClassHeader can be used.

Metadata version is supported if it is greater or equal than 1.1, and less or equal than COMPATIBLE_METADATA_VERSION + 1 minor version. Note that metadata version is 1.1 for Kotlin < 1.4, and is equal to the language version starting from Kotlin 1.4. For example, if the latest Kotlin version is 1.7.0, the latest kotlinx-metadata-jvm can read binaries produced by Kotlin compilers from 1.0 to 1.8.* inclusively.

See also


if the metadata version is unsupported