readLenient

Reads and parses the given annotation data of a Kotlin JVM class file and returns the correct type of KotlinClassMetadata encoded by this annotation. KotlinClassMetadata instances obtained from this method cannot be written.

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

This method makes best effort to read unsupported metadata versions. If metadata version is greater than JvmMetadataVersion.LATEST_STABLE_SUPPORTED + 1, this method still attempts to read it and may ignore parts of the metadata it does not understand. Keep in mind that this method will still throw an exception if metadata is changed in an unpredictable way. Because obtained metadata can be incomplete, its KotlinClassMetadata.write method will throw an exception. This method still cannot read metadata produced by pre-1.0 compilers.

See also

Throws

if the metadata version is that of Kotlin 1.0 or metadata format has been changed in an unpredictable way and reading of incompatible metadata is not possible