AccessBridge
Bootstrap methods for invokedynamic call sites emitted by the access-widening bytecode transform in ScriptWeave. Each bootstrap resolves a private/protected/package-private member via MethodHandles.privateLookupIn and returns a ConstantCallSite, which the JIT can inline.
This class lives on the game loader (not impl/), so script classes loaded by the masking loader can resolve it via parent delegation — same cross-loader pattern as ReplBridge and PatchEnterCallback.
The call-site MethodType is not the real signature. Widening a member's access is only half the job: a call site whose descriptor names an inaccessible class is rejected while the JVM resolves that descriptor, before any bootstrap here runs (e.g. a descriptor naming package-private kotlin.collections.EmptyMap is rejected). So the transform erases every inaccessible reference type in the call-site descriptor to Any and passes the real names through as string bootstrap arguments instead.
Two consequences for every bootstrap below:
typecannot be trusted for the member's real type — the field bootstraps read it reflectively via findField, the method bootstraps take it from thedescargument.Every returned handle is MethodHandle.asType'd to
type, which inserts the casts between the erased Any view and the real types.
ScriptWeave names each bootstrap by a descriptor it writes out itself, so all of them are @JvmStatic and spell their return type: one inferred as ConstantCallSite would link against nothing, at the first private access.
Functions
A Kotlin private val has a backing field and no accessor, yet the metadata flip makes the frontend emit getXxx() against it — resolve such a call to the field instead. An object, companion or top-level property backs onto a STATIC field, so hasReceiver says whether the call site passes one that the handle has to swallow.
Kotlin capitalizes ASCII only, so URL and _options keep their head.
Bootstrap checkcast. The identity handle takes exactly that class, so asType from the call site's Object inserts checkcast's own check: null passes, anything else that is not an instance throws ClassCastException.
Bootstrap a class literal, ::class, as a dynamic constant.
Bootstrap a constructor call; desc is the constructor's own, and the instance comes back as the call's result. Resolved like every other member the bridge reaches, so a non-public constructor opens too.
Bootstrap a GETFIELD call site.
f as the accessor it backs, or null where it needs an instance a static call site does not have.
Bootstrap a PUTFIELD call site.
JvmAbi.getterName: an is-prefixed property is already its own getter.
Bootstrap instanceof: Class.isInstance is the same test, null failing it.
Every interface reachable from ref, breadth-first.
JvmAbi.startsWithIsPrefix: is followed by anything that is not a lower-case letter.
MethodHandles.privateLookupIn on cls, or caller where its module refuses to open — java.base being the one that does.
Bootstrap anewarray: owner is the element class, and the array a real array of it, so storing anything else still throws ArrayStoreException.
JvmAbi.setterName: the is is dropped rather than kept — isEmpty sets via setEmpty.
Bootstrap an INVOKESTATIC call site; the real signature is in desc, the declaring class resolved via findMethodOwner.
Bootstrap a GETSTATIC call site.
Bootstrap a PUTSTATIC call site.
Bootstrap a super.method(...) call, opened like every other member: invokespecial from the declaring class findMethodOwner finds selects what the snippet's call would have — the first declaration up from the class the call names.
ref and its superclasses, nearest first.
Bootstrap an INVOKEVIRTUAL/INVOKEINTERFACE call site; the real signature is in desc, the declaring class resolved via findMethodOwner.