FlatRemapper

private class FlatRemapper(val classMap: Map<String, String>, val methodMap: Map<String, String>, val fieldMap: Map<String, String>, val ignoreFieldDesc: Boolean, val symbols: SymbolIndex)

Immutable mapping tables + a lazily-built immutable MC hierarchy; each eval is a plain ASM ClassRemapper. Member lookups climb owner→ancestors (super first, then interfaces); a game owner's answer is memoized, a module's own is not (ModuleRemapper). All state is immutable or a ConcurrentHashMap memo, so many lanes may remap concurrently.

Constructors

Link copied to clipboard
constructor(classMap: Map<String, String>, methodMap: Map<String, String>, fieldMap: Map<String, String>, ignoreFieldDesc: Boolean, symbols: SymbolIndex)

Types

Link copied to clipboard
private inner class MetaRewriter(sink: ClassVisitor, val remapper: FlatRemapper.ModuleRemapper) : ClassVisitor

Rewrites the @Metadata proto alongside the bytecode. Sits ABOVE the ClassRemapper, so the proto handed down is already in the runtime namespace: ASM remaps an annotation's Type values and nothing else, and d1/d2 are plain strings it would pass straight through — which is what left kotlin-reflect resolving mojmap classifiers no non-mojmap runtime has, degrading to ??? or throwing with the name nowhere in the message. remapper is the bytecode's, the only one that knows this module's classes.

Link copied to clipboard
private inner class ModuleRemapper(val own: Map<String, Array<String>>) : Remapper

One module's remap. ASM hands a callback nothing but owner, name and descriptor, so the module's own classes (own, each to its direct supertypes) ride on the remapper. A member they own is resolved every time, never memoized: its key spells this eval's names, which no later eval asks for — and one reusing a name would get this module's answer.

Properties

Link copied to clipboard
private val classMap: Map<String, String>
Link copied to clipboard
private val fieldMap: Map<String, String>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
private val methodMap: Map<String, String>
Link copied to clipboard
Link copied to clipboard
private val none: Array<String>
Link copied to clipboard
Link copied to clipboard
private val symbols: SymbolIndex

Functions

Link copied to clipboard

cr's direct supertypes, super first then interfaces; a null super is java/lang/Object.

Link copied to clipboard

Remap every .class in input — bytecode AND @Metadata. Sidecar files (.kotlin_module etc.) ride along unchanged.

Link copied to clipboard
private fun resolve(owner: String, name: String, desc: String, field: Boolean, supers: (String) -> Array<String>): String?

owner + all ancestors, transitively; first table hit wins (see class note on why first==correct).

Link copied to clipboard
private fun rewrite(cap: MetaCapture, owner: String, remapper: FlatRemapper.ModuleRemapper): Map<String, Any?>?

The rewritten @Metadata fields, or null to re-emit the original verbatim.

Link copied to clipboard
private fun supersOf(name: String): Array<String>

name's direct supertypes, cached. Two sources: mc-symbols; and the game loader, which holds the only copy of a mod / loader type that subclasses MC. A name neither answers has no known supers → empty.