Companion

object Companion

Collection of methods for reading and writing KotlinClassMetadata, as well as metadata kind constants.

Properties

Link copied to clipboard
const val CLASS_KIND: Int = 1

A class file kind signifying that the corresponding class file contains a declaration of a Kotlin class.

Link copied to clipboard
const val FILE_FACADE_KIND: Int = 2

A class file kind signifying that the corresponding class file is a compiled Kotlin file facade.

Link copied to clipboard

A class file kind signifying that the corresponding class file is a compiled multi-file class facade.

Link copied to clipboard

A class file kind signifying that the corresponding class file is a compiled multi-file class part, i.e., an internal class with method bodies and their metadata, accessed only from the corresponding facade.

Link copied to clipboard
const val SYNTHETIC_CLASS_KIND: Int = 3

A class file kind signifying that the corresponding class file is synthetic, e.g., it is a class for lambda, $DefaultImpls class for interface method implementations, $WhenMappings class for optimized when over enums, etc.

Functions

Link copied to clipboard

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.

Link copied to clipboard

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.

Link copied to clipboard
fun transform(metadata: Metadata, transformer: (KotlinClassMetadata) -> Unit): Metadata

Utility method to combine reading and writing of metadata: First, metadata is parsed with readStrict; then, transformer is called on a read instance. transformer may mutate passed instance of KotlinClassMetadata to achieve a desired result. After transformation, KotlinClassMetadata.write method is called and its result becomes return value of this method.