AccessWideningVisitor

internal class AccessWideningVisitor(mv: MethodVisitor, val declaredHere: (String, String, String) -> Boolean, val own: Set<String>, val superInit: String?) : MethodVisitor

own is the module's classes — see erase. superInit is the direct superclass when the visited method is a constructor, null otherwise — see bridgeSpecial.

Constructors

Link copied to clipboard
constructor(mv: MethodVisitor, declaredHere: (String, String, String) -> Boolean, own: Set<String>, superInit: String?)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
protected val api: Int
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
protected var mv: MethodVisitor?
Link copied to clipboard
private val own: Set<String>
Link copied to clipboard
private val superInit: String?

Functions

Link copied to clipboard
private fun bridgeSpecial(owner: String, name: String, descriptor: String, isInterface: Boolean): Boolean

Reroutes a class's invokespecial through the bridge. A super call always goes, as every other call to a foreign member does: AccessBridge.superCall opens the method, and its erased descriptor takes an argument that crossed the bridge as Object. A constructor goes only where the call as written would fail — its descriptor names a type the bridge erased, so verification would fail, and the whole class with it; or the constructor itself is not public (closedInit) — since rerouting one costs a discarded allocation. True if owner's call was rerouted.

Link copied to clipboard
private fun typeIndy(bootstrap: String, desc: String, type: String)

A type instruction on type — an internal name, or an array descriptor — as an indy through bootstrap.

Link copied to clipboard
open fun visitAnnotableParameterCount(parameterCount: Int, visible: Boolean)
Link copied to clipboard
open fun visitAnnotation(descriptor: String?, visible: Boolean): AnnotationVisitor?
Link copied to clipboard
Link copied to clipboard
open fun visitAttribute(attribute: Attribute?)
Link copied to clipboard
open fun visitCode()
Link copied to clipboard
open fun visitEnd()
Link copied to clipboard
open override fun visitFieldInsn(opcode: Int, owner: String, name: String, descriptor: String)
Link copied to clipboard
open fun visitFrame(type: Int, numLocal: Int, local: Array<out Any?>?, numStack: Int, stack: Array<out Any?>?)
Link copied to clipboard
open fun visitIincInsn(varIndex: Int, increment: Int)
Link copied to clipboard
open fun visitInsn(opcode: Int)
Link copied to clipboard
open fun visitInsnAnnotation(typeRef: Int, typePath: TypePath?, descriptor: String?, visible: Boolean): AnnotationVisitor?
Link copied to clipboard
open fun visitIntInsn(opcode: Int, operand: Int)
Link copied to clipboard
open override fun visitInvokeDynamicInsn(name: String, descriptor: String, bsm: Handle, vararg bsmArgs: Any?)

Lambdas (LambdaMetafactory call sites the Kotlin compiler emits). Two things here name a type we erased and must move with it: the captured-argument descriptor, and the impl-method handle — which points at the snippet's OWN synthetic method, whose signature widenAccessClass's visitMethod already erased. instantiatedMethodType describes that handle, so it moves too (INSTANTIATED_TYPE).

Link copied to clipboard
open fun visitJumpInsn(opcode: Int, label: Label?)
Link copied to clipboard
open fun visitLabel(label: Label?)
Link copied to clipboard
open override fun visitLdcInsn(value: Any?)

A class literal, ::class, of a class a snippet cannot name, as a dynamic constant AccessBridge.classConstant resolves by name, where loading is not access-checked: still a constant, now one the snippet can load.

Link copied to clipboard
open fun visitLineNumber(line: Int, start: Label?)
Link copied to clipboard
open fun visitLocalVariable(name: String?, descriptor: String?, signature: String?, start: Label?, end: Label?, index: Int)
Link copied to clipboard
open fun visitLocalVariableAnnotation(typeRef: Int, typePath: TypePath?, start: Array<out Label?>?, end: Array<out Label?>?, index: IntArray?, descriptor: String?, visible: Boolean): AnnotationVisitor?
Link copied to clipboard
open fun visitLookupSwitchInsn(dflt: Label?, keys: IntArray?, labels: Array<out Label?>?)
Link copied to clipboard
open fun visitMaxs(maxStack: Int, maxLocals: Int)
Link copied to clipboard
open override fun visitMethodInsn(opcode: Int, owner: String, name: String, descriptor: String, isInterface: Boolean)
open fun visitMethodInsn(opcode: Int, owner: String?, name: String?, descriptor: String?)
Link copied to clipboard
open fun visitMultiANewArrayInsn(descriptor: String?, numDimensions: Int)
Link copied to clipboard
open fun visitParameter(name: String?, access: Int)
Link copied to clipboard
open fun visitParameterAnnotation(parameter: Int, descriptor: String?, visible: Boolean): AnnotationVisitor?
Link copied to clipboard
open fun visitTableSwitchInsn(min: Int, max: Int, dflt: Label?, vararg labels: Label?)
Link copied to clipboard
open fun visitTryCatchAnnotation(typeRef: Int, typePath: TypePath?, descriptor: String?, visible: Boolean): AnnotationVisitor?
Link copied to clipboard
open fun visitTryCatchBlock(start: Label?, end: Label?, handler: Label?, type: String?)
Link copied to clipboard
open fun visitTypeAnnotation(typeRef: Int, typePath: TypePath?, descriptor: String?, visible: Boolean): AnnotationVisitor?
Link copied to clipboard
open override fun visitTypeInsn(opcode: Int, type: String)

A type instruction naming a class a snippet cannot is itself access-checked. Each of the three with a fixed stack shape therefore moves into the bridge, which loads the class by name, where loading is not access-checked, and keeps the instruction's own semantics:

Link copied to clipboard
open fun visitVarInsn(opcode: Int, varIndex: Int)