Companion

object Companion

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

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

The latest stable metadata version supported by this version of the library. The library can read Kotlin metadata produced by Kotlin compilers from 1.0 up to and including this version + 1 minor.

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, if metadata version is supported.

Link copied to clipboard
fun writeClass(kmClass: KmClass, metadataVersion: IntArray = COMPATIBLE_METADATA_VERSION, extraInt: Int = 0): Metadata

Writes contents of kmClass as the class metadata.

Link copied to clipboard
fun writeFileFacade(kmPackage: KmPackage, metadataVersion: IntArray = COMPATIBLE_METADATA_VERSION, extraInt: Int = 0): Metadata

Writes kmPackage contents as the file facade metadata.

Link copied to clipboard
fun writeLambda(kmLambda: KmLambda, metadataVersion: IntArray = COMPATIBLE_METADATA_VERSION, extraInt: Int = 0): Metadata

Writes kmLambda as the synthetic class metadata.

Link copied to clipboard
fun writeMultiFileClassFacade(partClassNames: List<String>, metadataVersion: IntArray = COMPATIBLE_METADATA_VERSION, extraInt: Int = 0): Metadata

Writes metadata of the multi-file class facade.

Link copied to clipboard
fun writeMultiFileClassPart(kmPackage: KmPackage, facadeClassName: String, metadataVersion: IntArray = COMPATIBLE_METADATA_VERSION, extraInt: Int = 0): Metadata

Writes the metadata of the multi-file class part.

Link copied to clipboard
fun writeSyntheticClass(metadataVersion: IntArray = COMPATIBLE_METADATA_VERSION, extraInt: Int = 0): Metadata

Writes synthetic class metadata.