readStrict

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 the 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.

This method can read only supported metadata versions (see JvmMetadataVersion.LATEST_STABLE_SUPPORTED for definition). It will throw an exception if the metadata version is greater than what kotlinx-metadata-jvm understands. It is suitable when your tooling cannot tolerate reading potentially incomplete or incorrect information due to version differences. It is also the only method that allows metadata transformation and KotlinClassMetadata.write subsequent calls.

See also

Throws

if the metadata version is unsupported or if metadata is corrupted