MetaCapture

internal class MetaCapture : AnnotationVisitor

Captures a @kotlin.Metadata annotation during an ASM read, and re-emits it — verbatim, or as a rewritten replacement. Stores ONLY the fields the original actually carried, which is what makes a verbatim re-emit add nothing: a lambda class (k=3) carries no d1, and an empty one reads back as a deserializable proto, NPEing readFunctionDataFrom deep inside the inliner. Primitive arrays (mv/bv) arrive as one value; string arrays (d1/d2) arrive element-by-element via a nested visitArray visitor.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
protected val api: Int
Link copied to clipboard
protected var av: AnnotationVisitor?
Link copied to clipboard
open val delegate: AnnotationVisitor?
Link copied to clipboard
private val fields: LinkedHashMap<String, Any?>

Field name (@Metadata's JvmNames: k/mv/bv/d1/d2/xs/pn/xi) -> value; string arrays held as List.

Link copied to clipboard
val kind: Int

Functions

Link copied to clipboard
fun emit(av: AnnotationVisitor, replacement: Map<String, Any?>?)

Emit replacement (a rewrite) or the captured fields verbatim into av.

Link copied to clipboard

Which fields the original annotation actually carried — the set a rewrite must reproduce one-for-one.

Link copied to clipboard
fun original(name: String): Any?

What a rewrite cannot reproduce, read off the original — see fieldOr.

Link copied to clipboard
private fun strings(n: String): Array<String>?
Link copied to clipboard

The captured annotation as a real Metadata, for kotlin-metadata to read.

Link copied to clipboard
open override fun visit(name: String?, value: Any?)
Link copied to clipboard
open fun visitAnnotation(name: String?, descriptor: String?): AnnotationVisitor?
Link copied to clipboard
open override fun visitArray(name: String?): AnnotationVisitor?
Link copied to clipboard
open fun visitEnd()
Link copied to clipboard
open fun visitEnum(name: String?, descriptor: String?, value: String?)