Use last asm api for visitor construction
This commit is contained in:
@@ -350,7 +350,7 @@ open class IncrementalJvmCache(
|
||||
private fun getConstantsMap(bytes: ByteArray): Map<String, Any> {
|
||||
val result = HashMap<String, Any>()
|
||||
|
||||
ClassReader(bytes).accept(object : ClassVisitor(Opcodes.ASM5) {
|
||||
ClassReader(bytes).accept(object : ClassVisitor(Opcodes.API_VERSION) {
|
||||
override fun visitField(access: Int, name: String, desc: String, signature: String?, value: Any?): FieldVisitor? {
|
||||
val staticFinal = Opcodes.ACC_STATIC or Opcodes.ACC_FINAL or Opcodes.ACC_PRIVATE
|
||||
if (value != null && access and staticFinal == Opcodes.ACC_STATIC or Opcodes.ACC_FINAL) {
|
||||
@@ -470,7 +470,7 @@ open class IncrementalJvmCache(
|
||||
|
||||
val result = HashMap<String, Long>()
|
||||
|
||||
ClassReader(bytes).accept(object : ClassVisitor(Opcodes.ASM5) {
|
||||
ClassReader(bytes).accept(object : ClassVisitor(Opcodes.API_VERSION) {
|
||||
override fun visitMethod(
|
||||
access: Int,
|
||||
name: String,
|
||||
@@ -478,9 +478,9 @@ open class IncrementalJvmCache(
|
||||
signature: String?,
|
||||
exceptions: Array<out String>?
|
||||
): MethodVisitor? {
|
||||
val dummyClassWriter = ClassWriter(Opcodes.ASM5)
|
||||
val dummyClassWriter = ClassWriter(Opcodes.API_VERSION)
|
||||
|
||||
return object : MethodVisitor(Opcodes.ASM5, dummyClassWriter.visitMethod(0, name, desc, null, exceptions)) {
|
||||
return object : MethodVisitor(Opcodes.API_VERSION, dummyClassWriter.visitMethod(0, name, desc, null, exceptions)) {
|
||||
override fun visitEnd() {
|
||||
val jvmName = name + desc
|
||||
if (jvmName !in inlineFunctions) return
|
||||
|
||||
@@ -31,8 +31,8 @@ import java.util.List;
|
||||
import static org.jetbrains.kotlin.codegen.inline.InlineCodegenUtilsKt.GENERATE_SMAP;
|
||||
|
||||
public abstract class AbstractClassBuilder implements ClassBuilder {
|
||||
protected static final MethodVisitor EMPTY_METHOD_VISITOR = new MethodVisitor(Opcodes.ASM5) {};
|
||||
protected static final FieldVisitor EMPTY_FIELD_VISITOR = new FieldVisitor(Opcodes.ASM5) {};
|
||||
protected static final MethodVisitor EMPTY_METHOD_VISITOR = new MethodVisitor(Opcodes.API_VERSION) {};
|
||||
protected static final FieldVisitor EMPTY_FIELD_VISITOR = new FieldVisitor(Opcodes.API_VERSION) {};
|
||||
|
||||
private String thisName;
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ public abstract class AnnotationCodegen {
|
||||
new JvmFlagAnnotation(JvmAnnotationUtilKt.SYNCHRONIZED_ANNOTATION_FQ_NAME.asString(), Opcodes.ACC_SYNCHRONIZED)
|
||||
);
|
||||
|
||||
private static final AnnotationVisitor NO_ANNOTATION_VISITOR = new AnnotationVisitor(Opcodes.ASM5) {
|
||||
private static final AnnotationVisitor NO_ANNOTATION_VISITOR = new AnnotationVisitor(Opcodes.API_VERSION) {
|
||||
@Override
|
||||
public AnnotationVisitor visitAnnotation(String name, @NotNull String desc) {
|
||||
return safe(super.visitAnnotation(name, desc));
|
||||
|
||||
@@ -53,7 +53,7 @@ fun createMethodNodeForAlwaysEnabledAssert(
|
||||
|
||||
val node =
|
||||
org.jetbrains.org.objectweb.asm.tree.MethodNode(
|
||||
Opcodes.ASM5,
|
||||
Opcodes.API_VERSION,
|
||||
Opcodes.ACC_STATIC,
|
||||
"fake",
|
||||
typeMapper.mapAsmMethod(functionDescriptor).descriptor, null, null
|
||||
|
||||
@@ -34,7 +34,7 @@ abstract class TransformationMethodVisitor(
|
||||
desc: String,
|
||||
signature: String?,
|
||||
exceptions: Array<out String>?,
|
||||
api: Int = Opcodes.ASM5
|
||||
api: Int = Opcodes.API_VERSION
|
||||
) : MethodVisitor(api) {
|
||||
|
||||
private val methodNode = MethodNode(access, name, desc, signature, exceptions).apply {
|
||||
@@ -70,7 +70,7 @@ abstract class TransformationMethodVisitor(
|
||||
performTransformations(methodNode)
|
||||
}
|
||||
|
||||
methodNode.accept(EndIgnoringMethodVisitorDecorator(Opcodes.ASM5, delegate))
|
||||
methodNode.accept(EndIgnoringMethodVisitorDecorator(Opcodes.API_VERSION, delegate))
|
||||
|
||||
|
||||
// In case of empty instructions list MethodNode.accept doesn't call visitLocalVariables of delegate
|
||||
|
||||
+2
-2
@@ -354,8 +354,8 @@ class CoroutineTransformerMethodVisitor(
|
||||
methodNode.instructions.resetLabels()
|
||||
methodNode.accept(
|
||||
MaxStackFrameSizeAndLocalsCalculator(
|
||||
Opcodes.ASM5, methodNode.access, methodNode.desc,
|
||||
object : MethodVisitor(Opcodes.ASM5) {
|
||||
Opcodes.API_VERSION, methodNode.access, methodNode.desc,
|
||||
object : MethodVisitor(Opcodes.API_VERSION) {
|
||||
override fun visitMaxs(maxStack: Int, maxLocals: Int) {
|
||||
methodNode.maxStack = maxStack
|
||||
}
|
||||
|
||||
+3
-3
@@ -340,7 +340,7 @@ fun createMethodNodeForIntercepted(
|
||||
|
||||
val node =
|
||||
MethodNode(
|
||||
Opcodes.ASM5,
|
||||
Opcodes.API_VERSION,
|
||||
Opcodes.ACC_STATIC,
|
||||
"fake",
|
||||
typeMapper.mapAsmMethod(functionDescriptor).descriptor, null, null
|
||||
@@ -366,7 +366,7 @@ fun createMethodNodeForCoroutineContext(
|
||||
|
||||
val node =
|
||||
MethodNode(
|
||||
Opcodes.ASM5,
|
||||
Opcodes.API_VERSION,
|
||||
Opcodes.ACC_STATIC,
|
||||
"fake",
|
||||
Type.getMethodDescriptor(languageVersionSettings.coroutineContextAsmType()),
|
||||
@@ -395,7 +395,7 @@ fun createMethodNodeForSuspendCoroutineUninterceptedOrReturn(
|
||||
|
||||
val node =
|
||||
MethodNode(
|
||||
Opcodes.ASM5,
|
||||
Opcodes.API_VERSION,
|
||||
Opcodes.ACC_STATIC,
|
||||
"fake",
|
||||
typeMapper.mapAsmMethod(functionDescriptor).descriptor, null, null
|
||||
|
||||
@@ -56,7 +56,7 @@ import java.io.PrintWriter
|
||||
import java.io.StringWriter
|
||||
|
||||
const val GENERATE_SMAP = true
|
||||
const val API = Opcodes.ASM5
|
||||
const val API = Opcodes.API_VERSION
|
||||
const val NUMBERED_FUNCTION_PREFIX = "kotlin/jvm/functions/Function"
|
||||
const val INLINE_FUN_VAR_SUFFIX = "\$iv"
|
||||
|
||||
|
||||
+1
-1
@@ -251,7 +251,7 @@ class RedundantBoxingMethodTransformer(private val generationState: GenerationSt
|
||||
castWithType: Pair<AbstractInsnNode, Type>
|
||||
) {
|
||||
val castInsn = castWithType.getFirst()
|
||||
val castInsnsListener = MethodNode(Opcodes.ASM5)
|
||||
val castInsnsListener = MethodNode(Opcodes.API_VERSION)
|
||||
InstructionAdapter(castInsnsListener).cast(value.unboxedType, castWithType.getSecond())
|
||||
|
||||
for (insn in castInsnsListener.instructions.toArray()) {
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ import static org.jetbrains.kotlin.codegen.optimization.common.StrictBasicValue.
|
||||
|
||||
public class OptimizationBasicInterpreter extends Interpreter<BasicValue> implements Opcodes {
|
||||
public OptimizationBasicInterpreter() {
|
||||
super(ASM5);
|
||||
super(API_VERSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.jetbrains.org.objectweb.asm.Opcodes.*
|
||||
import org.jetbrains.org.objectweb.asm.Type
|
||||
import org.jetbrains.org.objectweb.asm.tree.*
|
||||
|
||||
const val OPTIMIZATION_ASM_API_VERSION = Opcodes.ASM5
|
||||
const val OPTIMIZATION_ASM_API_VERSION = Opcodes.API_VERSION
|
||||
|
||||
val AbstractInsnNode.isMeaningful: Boolean
|
||||
get() =
|
||||
@@ -80,8 +80,8 @@ fun MethodNode.prepareForEmitting() {
|
||||
maxStack = -1
|
||||
accept(
|
||||
MaxStackFrameSizeAndLocalsCalculator(
|
||||
Opcodes.ASM5, access, desc,
|
||||
object : MethodVisitor(Opcodes.ASM5) {
|
||||
Opcodes.API_VERSION, access, desc,
|
||||
object : MethodVisitor(Opcodes.API_VERSION) {
|
||||
override fun visitMaxs(maxStack: Int, maxLocals: Int) {
|
||||
this@prepareForEmitting.maxStack = maxStack
|
||||
}
|
||||
|
||||
+8
-8
@@ -34,7 +34,7 @@ import org.jetbrains.org.objectweb.asm.*;
|
||||
import java.util.*;
|
||||
|
||||
import static org.jetbrains.org.objectweb.asm.ClassReader.*;
|
||||
import static org.jetbrains.org.objectweb.asm.Opcodes.ASM5;
|
||||
import static org.jetbrains.org.objectweb.asm.Opcodes.API_VERSION;
|
||||
|
||||
public abstract class FileBasedKotlinClass implements KotlinJvmBinaryClass {
|
||||
private final ClassId classId;
|
||||
@@ -93,7 +93,7 @@ public abstract class FileBasedKotlinClass implements KotlinJvmBinaryClass {
|
||||
Ref<String> classNameRef = Ref.create();
|
||||
Ref<Integer> classVersion = Ref.create();
|
||||
InnerClassesInfo innerClasses = new InnerClassesInfo();
|
||||
new ClassReader(fileContents).accept(new ClassVisitor(ASM5) {
|
||||
new ClassReader(fileContents).accept(new ClassVisitor(API_VERSION) {
|
||||
@Override
|
||||
public void visit(int version, int access, @NotNull String name, String signature, String superName, String[] interfaces) {
|
||||
classNameRef.set(name);
|
||||
@@ -145,7 +145,7 @@ public abstract class FileBasedKotlinClass implements KotlinJvmBinaryClass {
|
||||
@Override
|
||||
public void loadClassAnnotations(@NotNull AnnotationVisitor annotationVisitor, @Nullable byte[] cachedContents) {
|
||||
byte[] fileContents = cachedContents != null ? cachedContents : getFileContents();
|
||||
new ClassReader(fileContents).accept(new ClassVisitor(ASM5) {
|
||||
new ClassReader(fileContents).accept(new ClassVisitor(API_VERSION) {
|
||||
@Override
|
||||
public org.jetbrains.org.objectweb.asm.AnnotationVisitor visitAnnotation(@NotNull String desc, boolean visible) {
|
||||
return convertAnnotationVisitor(annotationVisitor, desc, innerClasses);
|
||||
@@ -170,7 +170,7 @@ public abstract class FileBasedKotlinClass implements KotlinJvmBinaryClass {
|
||||
private static org.jetbrains.org.objectweb.asm.AnnotationVisitor convertAnnotationVisitor(
|
||||
@NotNull AnnotationArgumentVisitor v, @NotNull InnerClassesInfo innerClasses
|
||||
) {
|
||||
return new org.jetbrains.org.objectweb.asm.AnnotationVisitor(ASM5) {
|
||||
return new org.jetbrains.org.objectweb.asm.AnnotationVisitor(API_VERSION) {
|
||||
@Override
|
||||
public void visit(String name, @NotNull Object value) {
|
||||
if (value instanceof Type) {
|
||||
@@ -184,7 +184,7 @@ public abstract class FileBasedKotlinClass implements KotlinJvmBinaryClass {
|
||||
@Override
|
||||
public org.jetbrains.org.objectweb.asm.AnnotationVisitor visitArray(String name) {
|
||||
AnnotationArrayArgumentVisitor arv = v.visitArray(Name.identifier(name));
|
||||
return arv == null ? null : new org.jetbrains.org.objectweb.asm.AnnotationVisitor(ASM5) {
|
||||
return arv == null ? null : new org.jetbrains.org.objectweb.asm.AnnotationVisitor(API_VERSION) {
|
||||
@Override
|
||||
public void visit(String name, @NotNull Object value) {
|
||||
if (value instanceof Type) {
|
||||
@@ -228,13 +228,13 @@ public abstract class FileBasedKotlinClass implements KotlinJvmBinaryClass {
|
||||
@Override
|
||||
public void visitMembers(@NotNull MemberVisitor memberVisitor, @Nullable byte[] cachedContents) {
|
||||
byte[] fileContents = cachedContents != null ? cachedContents : getFileContents();
|
||||
new ClassReader(fileContents).accept(new ClassVisitor(ASM5) {
|
||||
new ClassReader(fileContents).accept(new ClassVisitor(API_VERSION) {
|
||||
@Override
|
||||
public FieldVisitor visitField(int access, @NotNull String name, @NotNull String desc, String signature, Object value) {
|
||||
AnnotationVisitor v = memberVisitor.visitField(Name.identifier(name), desc, value);
|
||||
if (v == null) return null;
|
||||
|
||||
return new FieldVisitor(ASM5) {
|
||||
return new FieldVisitor(API_VERSION) {
|
||||
@Override
|
||||
public org.jetbrains.org.objectweb.asm.AnnotationVisitor visitAnnotation(@NotNull String desc, boolean visible) {
|
||||
return convertAnnotationVisitor(v, desc, innerClasses);
|
||||
@@ -253,7 +253,7 @@ public abstract class FileBasedKotlinClass implements KotlinJvmBinaryClass {
|
||||
if (v == null) return null;
|
||||
|
||||
int methodParamCount = Type.getArgumentTypes(desc).length;
|
||||
return new MethodVisitor(ASM5) {
|
||||
return new MethodVisitor(API_VERSION) {
|
||||
|
||||
private int visibleAnnotableParameterCount = methodParamCount;
|
||||
private int invisibleAnnotableParameterCount = methodParamCount;
|
||||
|
||||
+2
-2
@@ -65,11 +65,11 @@ class JavaModuleInfo(
|
||||
val exports = arrayListOf<Exports>()
|
||||
|
||||
try {
|
||||
ClassReader(contents).accept(object : ClassVisitor(Opcodes.ASM6) {
|
||||
ClassReader(contents).accept(object : ClassVisitor(Opcodes.API_VERSION) {
|
||||
override fun visitModule(name: String, access: Int, version: String?): ModuleVisitor {
|
||||
moduleName = name
|
||||
|
||||
return object : ModuleVisitor(Opcodes.ASM6) {
|
||||
return object : ModuleVisitor(Opcodes.API_VERSION) {
|
||||
override fun visitRequire(module: String, access: Int, version: String?) {
|
||||
requires.add(Requires(module, (access and ACC_TRANSITIVE) != 0))
|
||||
}
|
||||
|
||||
+3
-3
@@ -265,7 +265,7 @@ public class InterceptionInstrumenter {
|
||||
private byte[] instrument(byte[] classData, List<MethodInstrumenter> instrumenters) {
|
||||
ClassReader cr = new ClassReader(classData);
|
||||
ClassWriter cw = new ClassWriter(cr, 0);
|
||||
cr.accept(new ClassVisitor(ASM5, cw) {
|
||||
cr.accept(new ClassVisitor(API_VERSION, cw) {
|
||||
private final Map<MethodInstrumenter, String> matchedMethods = new HashMap<>();
|
||||
|
||||
@Override
|
||||
@@ -316,7 +316,7 @@ public class InterceptionInstrumenter {
|
||||
int maxStackDepth = getMaxStackDepth(name, desc, normalReturnData, enterData, exceptionData);
|
||||
boolean isConstructor = "<init>".equals(name);
|
||||
|
||||
return new MethodVisitor(ASM5, mv) {
|
||||
return new MethodVisitor(API_VERSION, mv) {
|
||||
|
||||
private InstructionAdapter ia = null;
|
||||
|
||||
@@ -421,7 +421,7 @@ public class InterceptionInstrumenter {
|
||||
}
|
||||
|
||||
private TraceMethodVisitor getDumpingVisitorWrapper(MethodVisitor mv, String methodName, String methodDesc) {
|
||||
return new TraceMethodVisitor(mv, new Textifier(ASM5) {
|
||||
return new TraceMethodVisitor(mv, new Textifier(API_VERSION) {
|
||||
@Override
|
||||
public void visitMethodEnd() {
|
||||
System.out.println(cr.getClassName() + ":" + methodName + methodDesc);
|
||||
|
||||
+3
-3
@@ -41,7 +41,7 @@ abstract class AbstractBytecodeListingTest : CodegenTestCase() {
|
||||
}
|
||||
}
|
||||
|
||||
class BytecodeListingTextCollectingVisitor(val filter: Filter, val withSignatures: Boolean, api: Int = ASM5) : ClassVisitor(api) {
|
||||
class BytecodeListingTextCollectingVisitor(val filter: Filter, val withSignatures: Boolean, api: Int = API_VERSION) : ClassVisitor(api) {
|
||||
companion object {
|
||||
@JvmOverloads
|
||||
fun getText(
|
||||
@@ -162,7 +162,7 @@ class BytecodeListingTextCollectingVisitor(val filter: Filter, val withSignature
|
||||
handleModifiers(access, methodAnnotations)
|
||||
val methodParamCount = Type.getArgumentTypes(desc).size
|
||||
|
||||
return object : MethodVisitor(ASM5) {
|
||||
return object : MethodVisitor(API_VERSION) {
|
||||
private var visibleAnnotableParameterCount = methodParamCount
|
||||
private var invisibleAnnotableParameterCount = methodParamCount
|
||||
|
||||
@@ -215,7 +215,7 @@ class BytecodeListingTextCollectingVisitor(val filter: Filter, val withSignature
|
||||
handleModifiers(access)
|
||||
if (access and ACC_VOLATILE != 0) addModifier("volatile", fieldDeclaration.annotations)
|
||||
|
||||
return object : FieldVisitor(ASM5) {
|
||||
return object : FieldVisitor(API_VERSION) {
|
||||
override fun visitAnnotation(desc: String, visible: Boolean): AnnotationVisitor? {
|
||||
addAnnotation(desc)
|
||||
return super.visitAnnotation(desc, visible)
|
||||
|
||||
+2
-2
@@ -100,14 +100,14 @@ abstract class AbstractCheckLocalVariablesTableTest : CodegenTestCase() {
|
||||
|
||||
private fun readLocalVariable(cr: ClassReader, methodName: String): List<LocalVariable> {
|
||||
|
||||
class Visitor : ClassVisitor(Opcodes.ASM5) {
|
||||
class Visitor : ClassVisitor(Opcodes.API_VERSION) {
|
||||
var readVariables: MutableList<LocalVariable> = ArrayList()
|
||||
|
||||
override fun visitMethod(
|
||||
access: Int, name: String, desc: String, signature: String?, exceptions: Array<String>?
|
||||
): MethodVisitor? {
|
||||
return if (methodName == name + desc) {
|
||||
object : MethodVisitor(Opcodes.ASM5) {
|
||||
object : MethodVisitor(Opcodes.API_VERSION) {
|
||||
override fun visitLocalVariable(
|
||||
name: String, desc: String, signature: String?, start: Label, end: Label, index: Int
|
||||
) {
|
||||
|
||||
@@ -72,7 +72,7 @@ abstract class AbstractLineNumberTest : CodegenTestCase() {
|
||||
val labels = arrayListOf<Label>()
|
||||
val labels2LineNumbers = HashMap<Label, String>()
|
||||
|
||||
val visitor = object : ClassVisitor(Opcodes.ASM5) {
|
||||
val visitor = object : ClassVisitor(Opcodes.API_VERSION) {
|
||||
override fun visitMethod(
|
||||
access: Int,
|
||||
name: String,
|
||||
@@ -95,7 +95,7 @@ abstract class AbstractLineNumberTest : CodegenTestCase() {
|
||||
labels: ArrayList<Label>,
|
||||
labels2LineNumbers: HashMap<Label, String>
|
||||
): MethodVisitor {
|
||||
return object : MethodVisitor(Opcodes.ASM5) {
|
||||
return object : MethodVisitor(Opcodes.API_VERSION) {
|
||||
private var lastLabel: Label? = null
|
||||
|
||||
override fun visitMethodInsn(opcode: Int, owner: String, name: String, desc: String, itf: Boolean) {
|
||||
@@ -119,7 +119,7 @@ abstract class AbstractLineNumberTest : CodegenTestCase() {
|
||||
val result = ArrayList<String>()
|
||||
val visitedLabels = HashSet<String>()
|
||||
|
||||
reader.accept(object : ClassVisitor(Opcodes.ASM5) {
|
||||
reader.accept(object : ClassVisitor(Opcodes.API_VERSION) {
|
||||
override fun visitMethod(
|
||||
access: Int,
|
||||
name: String,
|
||||
@@ -127,7 +127,7 @@ abstract class AbstractLineNumberTest : CodegenTestCase() {
|
||||
signature: String?,
|
||||
exceptions: Array<String>?
|
||||
): MethodVisitor {
|
||||
return object : MethodVisitor(Opcodes.ASM5) {
|
||||
return object : MethodVisitor(Opcodes.API_VERSION) {
|
||||
override fun visitLineNumber(line: Int, label: Label) {
|
||||
val overrides = !visitedLabels.add(label.toString())
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ object InlineTestUtil {
|
||||
|
||||
override fun visitAnnotation(desc: String, visible: Boolean): AnnotationVisitor? {
|
||||
if (desc == JvmAnnotationNames.METADATA_DESC) {
|
||||
return object : AnnotationVisitor(Opcodes.ASM5) {
|
||||
return object : AnnotationVisitor(Opcodes.API_VERSION) {
|
||||
override fun visit(name: String?, value: Any) {
|
||||
if (name == JvmAnnotationNames.KIND_FIELD_NAME && value == KotlinClassHeader.Kind.MULTIFILE_CLASS.id) {
|
||||
skipMethodsOfThisClass = true
|
||||
@@ -139,7 +139,7 @@ object InlineTestUtil {
|
||||
return null
|
||||
}
|
||||
|
||||
return object : MethodNode(Opcodes.ASM5, access, name, desc, signature, exceptions) {
|
||||
return object : MethodNode(Opcodes.API_VERSION, access, name, desc, signature, exceptions) {
|
||||
override fun visitMethodInsn(opcode: Int, owner: String, name: String, desc: String, itf: Boolean) {
|
||||
val methodCall = MethodInfo(owner, name, desc)
|
||||
if (inlinedMethods.contains(methodCall)) {
|
||||
@@ -233,7 +233,7 @@ object InlineTestUtil {
|
||||
|
||||
private data class MethodInfo(val owner: String, val name: String, val desc: String)
|
||||
|
||||
private open class ClassVisitorWithName : ClassVisitor(Opcodes.ASM5) {
|
||||
private open class ClassVisitorWithName : ClassVisitor(Opcodes.API_VERSION) {
|
||||
lateinit var className: String
|
||||
|
||||
override fun visit(version: Int, access: Int, name: String, signature: String?, superName: String?, interfaces: Array<String>?) {
|
||||
@@ -242,7 +242,7 @@ object InlineTestUtil {
|
||||
}
|
||||
}
|
||||
|
||||
private abstract class MethodNodeWithAnonymousObjectCheck(val inlineInfo: InlineInfo, access: Int, name: String, desc: String, signature: String?, exceptions: Array<String>?) : MethodNode(Opcodes.ASM5, access, name, desc, signature, exceptions) {
|
||||
private abstract class MethodNodeWithAnonymousObjectCheck(val inlineInfo: InlineInfo, access: Int, name: String, desc: String, signature: String?, exceptions: Array<String>?) : MethodNode(Opcodes.API_VERSION, access, name, desc, signature, exceptions) {
|
||||
private fun isInlineParameterLikeOwner(owner: String) =
|
||||
"$" in owner && !isTopLevelOrInnerOrPackageClass(owner, inlineInfo)
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ object SMAPTestUtil {
|
||||
private fun extractSMAPFromClasses(outputFiles: Iterable<OutputFile>): List<SMAPAndFile> {
|
||||
return outputFiles.mapNotNull { outputFile ->
|
||||
var debugInfo: String? = null
|
||||
ClassReader(outputFile.asByteArray()).accept(object : ClassVisitor(Opcodes.ASM5) {
|
||||
ClassReader(outputFile.asByteArray()).accept(object : ClassVisitor(Opcodes.API_VERSION) {
|
||||
override fun visitSource(source: String?, debug: String?) {
|
||||
debugInfo = debug
|
||||
}
|
||||
|
||||
+1
-1
@@ -161,7 +161,7 @@ public abstract class AbstractWriteFlagsTest extends CodegenTestCase {
|
||||
protected boolean isExists;
|
||||
|
||||
public TestClassVisitor() {
|
||||
super(Opcodes.ASM5);
|
||||
super(Opcodes.API_VERSION);
|
||||
}
|
||||
|
||||
abstract public int getAccess();
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ abstract class AbstractIrLineNumberTest : AbstractLineNumberTest() {
|
||||
labels: ArrayList<Label>,
|
||||
labels2LineNumbers: java.util.HashMap<Label, String>
|
||||
): MethodVisitor {
|
||||
return object : MethodVisitor(Opcodes.ASM5) {
|
||||
return object : MethodVisitor(Opcodes.API_VERSION) {
|
||||
private var lastLabel: Label? = null
|
||||
private var lastLine = -1
|
||||
|
||||
|
||||
+1
-1
@@ -118,7 +118,7 @@ abstract class AbstractWriteSignatureTest : CodegenTestCase() {
|
||||
)
|
||||
}
|
||||
|
||||
private inner class Checker : ClassVisitor(Opcodes.ASM5) {
|
||||
private inner class Checker : ClassVisitor(Opcodes.API_VERSION) {
|
||||
override fun visit(
|
||||
version: Int,
|
||||
access: Int,
|
||||
|
||||
@@ -67,11 +67,11 @@ class WrongBytecodeVersionTest : KtUsefulTestCase() {
|
||||
companion object {
|
||||
fun transformMetadataInClassFile(bytes: ByteArray, transform: (fieldName: String, value: Any?) -> Any?): ByteArray {
|
||||
val writer = ClassWriter(0)
|
||||
ClassReader(bytes).accept(object : ClassVisitor(Opcodes.ASM5, writer) {
|
||||
ClassReader(bytes).accept(object : ClassVisitor(Opcodes.API_VERSION, writer) {
|
||||
override fun visitAnnotation(desc: String, visible: Boolean): AnnotationVisitor {
|
||||
val superVisitor = super.visitAnnotation(desc, visible)
|
||||
if (desc == JvmAnnotationNames.METADATA_DESC) {
|
||||
return object : AnnotationVisitor(Opcodes.ASM5, superVisitor) {
|
||||
return object : AnnotationVisitor(Opcodes.API_VERSION, superVisitor) {
|
||||
override fun visit(name: String, value: Any) {
|
||||
super.visit(name, transform(name, value) ?: value)
|
||||
}
|
||||
@@ -79,7 +79,7 @@ class WrongBytecodeVersionTest : KtUsefulTestCase() {
|
||||
override fun visitArray(name: String): AnnotationVisitor {
|
||||
val entries = arrayListOf<String>()
|
||||
val arrayVisitor = { super.visitArray(name) }
|
||||
return object : AnnotationVisitor(Opcodes.ASM5) {
|
||||
return object : AnnotationVisitor(Opcodes.API_VERSION) {
|
||||
override fun visit(name: String?, value: Any) {
|
||||
entries.add(value as String)
|
||||
}
|
||||
|
||||
@@ -230,12 +230,12 @@ public class GenerateNotNullAssertionsTest extends CodegenTestCase {
|
||||
}
|
||||
ClassReader reader = new ClassReader(file.asByteArray());
|
||||
|
||||
reader.accept(new ClassVisitor(Opcodes.ASM5) {
|
||||
reader.accept(new ClassVisitor(Opcodes.API_VERSION) {
|
||||
@Override
|
||||
public MethodVisitor visitMethod(
|
||||
int access, @NotNull String callerName, @NotNull String callerDesc, String signature, String[] exceptions
|
||||
) {
|
||||
return new MethodVisitor(Opcodes.ASM5) {
|
||||
return new MethodVisitor(Opcodes.API_VERSION) {
|
||||
@Override
|
||||
public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) {
|
||||
assertFalse(
|
||||
|
||||
@@ -139,7 +139,7 @@ public class InnerClassInfoGenTest extends CodegenTestCase {
|
||||
ClassReader reader = new ClassReader(bytes);
|
||||
List<InnerClassAttribute> result = new ArrayList<>();
|
||||
|
||||
reader.accept(new ClassVisitor(ASM5) {
|
||||
reader.accept(new ClassVisitor(API_VERSION) {
|
||||
@Override
|
||||
public void visitInnerClass(@NotNull String name, String outerName, String innerName, int access) {
|
||||
result.add(new InnerClassAttribute(name, outerName, innerName, access));
|
||||
|
||||
@@ -168,7 +168,7 @@ class MethodOrderTest: CodegenTestCase() {
|
||||
|
||||
val methodNames = ArrayList<String>()
|
||||
|
||||
classReader.accept(object : ClassVisitor(Opcodes.ASM4) {
|
||||
classReader.accept(object : ClassVisitor(Opcodes.API_VERSION) {
|
||||
override fun visitMethod(access: Int, name: String, desc: String, signature: String?, exceptions: Array<out String>?): MethodVisitor? {
|
||||
methodNames.add(name + desc)
|
||||
return null
|
||||
|
||||
@@ -219,7 +219,7 @@ public class OuterClassGenTest extends CodegenTestCase {
|
||||
@Nullable
|
||||
private static OuterClassInfo readOuterClassInfo(@NotNull ClassReader reader) {
|
||||
Ref<OuterClassInfo> info = Ref.create();
|
||||
reader.accept(new ClassVisitor(Opcodes.ASM5) {
|
||||
reader.accept(new ClassVisitor(Opcodes.API_VERSION) {
|
||||
@Override
|
||||
public void visitOuterClass(@NotNull String owner, @Nullable String name, @Nullable String desc) {
|
||||
info.set(new OuterClassInfo(owner, name, desc));
|
||||
|
||||
@@ -44,7 +44,7 @@ public class SourceInfoGenTest extends CodegenTestCase {
|
||||
ClassReader classReader = new ClassReader(file.asByteArray());
|
||||
|
||||
String[] producer = new String[1];
|
||||
classReader.accept(new ClassVisitor(Opcodes.ASM5) {
|
||||
classReader.accept(new ClassVisitor(Opcodes.API_VERSION) {
|
||||
|
||||
@Override
|
||||
public void visitSource(String source, String debug) {
|
||||
|
||||
+7
-7
@@ -358,8 +358,8 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration
|
||||
compileKotlin("sourceInline.kt", tmpdir)
|
||||
|
||||
val inlineFunClass = File(tmpdir.absolutePath, "test/A.class")
|
||||
val cw = ClassWriter(Opcodes.ASM5)
|
||||
ClassReader(inlineFunClass.readBytes()).accept(object : ClassVisitor(Opcodes.ASM5, cw) {
|
||||
val cw = ClassWriter(Opcodes.API_VERSION)
|
||||
ClassReader(inlineFunClass.readBytes()).accept(object : ClassVisitor(Opcodes.API_VERSION, cw) {
|
||||
override fun visitSource(source: String?, debug: String?) {
|
||||
//skip debug info
|
||||
}
|
||||
@@ -374,7 +374,7 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration
|
||||
|
||||
var debugInfo: String? = null
|
||||
val resultFile = File(tmpdir.absolutePath, "test/B.class")
|
||||
ClassReader(resultFile.readBytes()).accept(object : ClassVisitor(Opcodes.ASM5) {
|
||||
ClassReader(resultFile.readBytes()).accept(object : ClassVisitor(Opcodes.API_VERSION) {
|
||||
override fun visitSource(source: String?, debug: String?) {
|
||||
debugInfo = debug
|
||||
}
|
||||
@@ -574,7 +574,7 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration
|
||||
private fun stripSuspensionMarksToImitateLegacyCompiler(bytes: ByteArray): Pair<ByteArray, Int> {
|
||||
val writer = ClassWriter(0)
|
||||
var removedCounter = 0
|
||||
ClassReader(bytes).accept(object : ClassVisitor(Opcodes.ASM5, writer) {
|
||||
ClassReader(bytes).accept(object : ClassVisitor(Opcodes.API_VERSION, writer) {
|
||||
override fun visitMethod(
|
||||
access: Int,
|
||||
name: String?,
|
||||
@@ -583,7 +583,7 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration
|
||||
exceptions: Array<out String>?
|
||||
): MethodVisitor {
|
||||
val superMV = super.visitMethod(access, name, desc, signature, exceptions)
|
||||
return object : MethodNode(Opcodes.ASM5, access, name, desc, signature, exceptions) {
|
||||
return object : MethodNode(Opcodes.API_VERSION, access, name, desc, signature, exceptions) {
|
||||
override fun visitEnd() {
|
||||
val removeList = instructions.asSequence()
|
||||
.flatMap { suspendMarkerInsns(it).asSequence() }.toList()
|
||||
@@ -644,11 +644,11 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration
|
||||
// If there's no "xi" field in the Metadata annotation, it's value is assumed to be 0, i.e. _not_ pre-release
|
||||
var isPreRelease = false
|
||||
|
||||
ClassReader(file.readBytes()).accept(object : ClassVisitor(Opcodes.ASM6) {
|
||||
ClassReader(file.readBytes()).accept(object : ClassVisitor(Opcodes.API_VERSION) {
|
||||
override fun visitAnnotation(desc: String, visible: Boolean): AnnotationVisitor? {
|
||||
if (desc != JvmAnnotationNames.METADATA_DESC) return null
|
||||
|
||||
return object : AnnotationVisitor(Opcodes.ASM6) {
|
||||
return object : AnnotationVisitor(Opcodes.API_VERSION) {
|
||||
override fun visit(name: String, value: Any) {
|
||||
if (name != JvmAnnotationNames.METADATA_EXTRA_INT_FIELD_NAME) return
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ interface Eval {
|
||||
fun invokeMethod(instance: Value, methodDesc: MethodDescription, arguments: List<Value>, invokespecial: Boolean = false): Value
|
||||
}
|
||||
|
||||
class SingleInstructionInterpreter(private val eval: Eval) : Interpreter<Value>(ASM5) {
|
||||
class SingleInstructionInterpreter(private val eval: Eval) : Interpreter<Value>(API_VERSION) {
|
||||
override fun newValue(type: Type?): Value? {
|
||||
if (type == null) {
|
||||
return NOT_A_VALUE
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.jetbrains.eval4j.ValueReturned
|
||||
import org.jetbrains.org.objectweb.asm.ClassReader
|
||||
import org.jetbrains.org.objectweb.asm.ClassVisitor
|
||||
import org.jetbrains.org.objectweb.asm.MethodVisitor
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes.ASM5
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes.API_VERSION
|
||||
import org.jetbrains.org.objectweb.asm.Type
|
||||
import org.jetbrains.org.objectweb.asm.tree.MethodNode
|
||||
import java.lang.reflect.Modifier
|
||||
@@ -38,9 +38,9 @@ fun buildTestSuite(
|
||||
|
||||
val ownerClass = TestData::class.java
|
||||
ownerClass.classLoader!!.getResourceAsStream(ownerClass.getInternalName() + ".class")!!.use { inputStream ->
|
||||
ClassReader(inputStream).accept(object : ClassVisitor(ASM5) {
|
||||
ClassReader(inputStream).accept(object : ClassVisitor(API_VERSION) {
|
||||
override fun visitMethod(access: Int, name: String, desc: String, signature: String?, exceptions: Array<out String>?): MethodVisitor? {
|
||||
return object : MethodNode(ASM5, access, name, desc, signature, exceptions) {
|
||||
return object : MethodNode(API_VERSION, access, name, desc, signature, exceptions) {
|
||||
override fun visitEnd() {
|
||||
val testCase = buildTestCase(ownerClass, this, create)
|
||||
if (testCase != null) {
|
||||
|
||||
+1
-1
@@ -214,7 +214,7 @@ private fun readLineNumberTableMapping(bytes: ByteArray): Map<BytecodeMethodKey,
|
||||
val methodLinesMapping = HashMap<String, MutableSet<Int>>()
|
||||
lineNumberMapping[methodKey] = methodLinesMapping
|
||||
|
||||
return object : MethodVisitor(Opcodes.ASM5, null) {
|
||||
return object : MethodVisitor(Opcodes.API_VERSION, null) {
|
||||
override fun visitLineNumber(line: Int, start: Label?) {
|
||||
if (start != null) {
|
||||
methodLinesMapping.getOrPutNullable(start.toString(), { LinkedHashSet<Int>() }).add(line)
|
||||
|
||||
+3
-3
@@ -87,7 +87,7 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
|
||||
import org.jetbrains.kotlin.resolve.isInlineClassType
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
|
||||
import org.jetbrains.org.objectweb.asm.*
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes.ASM5
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes.API_VERSION
|
||||
import org.jetbrains.org.objectweb.asm.Type
|
||||
import org.jetbrains.org.objectweb.asm.tree.ClassNode
|
||||
import org.jetbrains.org.objectweb.asm.tree.MethodNode
|
||||
@@ -353,14 +353,14 @@ class KotlinEvaluator(val codeFragment: KtCodeFragment, val sourcePosition: Sour
|
||||
// assert [0] with some context
|
||||
val mainClassBytecode = compiledData.mainClass.bytes
|
||||
|
||||
ClassReader(mainClassBytecode).accept(object : ClassVisitor(ASM5) {
|
||||
ClassReader(mainClassBytecode).accept(object : ClassVisitor(API_VERSION) {
|
||||
override fun visitMethod(access: Int, name: String, desc: String, signature: String?, exceptions: Array<out String>?): MethodVisitor? {
|
||||
// Maybe just take the single method from the class, as it is done in 'evaluateWithCompilation'
|
||||
if (name == GENERATED_FUNCTION_NAME || name.startsWith(GENERATED_FUNCTION_NAME + "-")) {
|
||||
val argumentTypes = Type.getArgumentTypes(desc)
|
||||
val args = context.getArgumentsForEval4j(compiledData.parameters, argumentTypes)
|
||||
|
||||
return object : MethodNode(Opcodes.ASM5, access, name, desc, signature, exceptions) {
|
||||
return object : MethodNode(Opcodes.API_VERSION, access, name, desc, signature, exceptions) {
|
||||
override fun visitEnd() {
|
||||
virtualMachine.executeWithBreakpointsDisabled {
|
||||
val eval = JDIEval(virtualMachine,
|
||||
|
||||
@@ -61,12 +61,12 @@ object KotlinJvmMetadataVersionIndex : KotlinMetadataVersionIndexBase<KotlinJvmM
|
||||
|
||||
tryBlock(inputData) {
|
||||
val classReader = ClassReader(inputData.content)
|
||||
classReader.accept(object : ClassVisitor(Opcodes.ASM6) {
|
||||
classReader.accept(object : ClassVisitor(Opcodes.API_VERSION) {
|
||||
override fun visitAnnotation(desc: String, visible: Boolean): AnnotationVisitor? {
|
||||
if (desc != METADATA_DESC) return null
|
||||
|
||||
annotationPresent = true
|
||||
return object : AnnotationVisitor(Opcodes.ASM6) {
|
||||
return object : AnnotationVisitor(Opcodes.API_VERSION) {
|
||||
override fun visit(name: String, value: Any) {
|
||||
when (name) {
|
||||
METADATA_VERSION_FIELD_NAME -> if (value is IntArray) {
|
||||
|
||||
@@ -46,7 +46,7 @@ private fun applyDexLikePatch(file: File) {
|
||||
}
|
||||
|
||||
private fun ClassVisitor.withRemoveSourceDebugExtensionVisitor(): ClassVisitor {
|
||||
return object : ClassVisitor(Opcodes.ASM5, this) {
|
||||
return object : ClassVisitor(Opcodes.API_VERSION, this) {
|
||||
override fun visitSource(source: String?, debug: String?) {
|
||||
super.visitSource(source, null)
|
||||
}
|
||||
@@ -54,11 +54,11 @@ private fun ClassVisitor.withRemoveSourceDebugExtensionVisitor(): ClassVisitor {
|
||||
}
|
||||
|
||||
private fun ClassVisitor.withRemoveSameLinesInLineTableVisitor(): ClassVisitor {
|
||||
return object : ClassVisitor(Opcodes.ASM5, this) {
|
||||
return object : ClassVisitor(Opcodes.API_VERSION, this) {
|
||||
override fun visitMethod(access: Int, name: String?, desc: String?, signature: String?, exceptions: Array<out String>?): MethodVisitor? {
|
||||
val methodVisitor = super.visitMethod(access, name, desc, signature, exceptions) ?: return null
|
||||
|
||||
return object : MethodVisitor(Opcodes.ASM5, methodVisitor) {
|
||||
return object : MethodVisitor(Opcodes.API_VERSION, methodVisitor) {
|
||||
val labels = HashSet<String>()
|
||||
|
||||
override fun visitLineNumber(line: Int, start: Label?) {
|
||||
|
||||
@@ -99,7 +99,7 @@ open class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
|
||||
private fun getMethodsOfClass(classFile: File): Set<String> {
|
||||
val result = TreeSet<String>()
|
||||
ClassReader(FileUtil.loadFileBytes(classFile)).accept(object : ClassVisitor(Opcodes.ASM5) {
|
||||
ClassReader(FileUtil.loadFileBytes(classFile)).accept(object : ClassVisitor(Opcodes.API_VERSION) {
|
||||
override fun visitMethod(access: Int, name: String, desc: String, signature: String?, exceptions: Array<String>?): MethodVisitor? {
|
||||
result.add(name)
|
||||
return null
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ internal fun loadCompilerVersion(compilerClasspath: List<File>): String {
|
||||
var result: String? = null
|
||||
|
||||
fun checkVersion(bytes: ByteArray) {
|
||||
ClassReader(bytes).accept(object : ClassVisitor(Opcodes.ASM5) {
|
||||
ClassReader(bytes).accept(object : ClassVisitor(Opcodes.API_VERSION) {
|
||||
override fun visitField(access: Int, name: String, desc: String, signature: String?, value: Any?): FieldVisitor {
|
||||
if (name == KotlinCompilerVersion::VERSION.name && value is String) {
|
||||
result = value
|
||||
|
||||
+1
-1
@@ -134,7 +134,7 @@ class ParcelableClinitClassBuilderInterceptorExtension : ClassBuilderInterceptor
|
||||
}
|
||||
}
|
||||
|
||||
private class ClinitAwareMethodVisitor(val parcelableName: String, mv: MethodVisitor) : MethodVisitor(Opcodes.ASM5, mv) {
|
||||
private class ClinitAwareMethodVisitor(val parcelableName: String, mv: MethodVisitor) : MethodVisitor(Opcodes.API_VERSION, mv) {
|
||||
override fun visitInsn(opcode: Int) {
|
||||
if (opcode == Opcodes.RETURN) {
|
||||
val iv = InstructionAdapter(this)
|
||||
|
||||
+1
-1
@@ -101,7 +101,7 @@ abstract class AbstractAndroidOnDestroyClassBuilderInterceptorExtension : ClassB
|
||||
signature: String?,
|
||||
exceptions: Array<out String>?
|
||||
): MethodVisitor {
|
||||
return object : MethodVisitor(Opcodes.ASM5, super.newMethod(origin, access, name, desc, signature, exceptions)) {
|
||||
return object : MethodVisitor(Opcodes.API_VERSION, super.newMethod(origin, access, name, desc, signature, exceptions)) {
|
||||
override fun visitInsn(opcode: Int) {
|
||||
if (opcode == Opcodes.RETURN) {
|
||||
generateClearCacheMethodCall()
|
||||
|
||||
@@ -7,4 +7,4 @@ package org.jetbrains.kotlin.jvm.abi.asm
|
||||
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes
|
||||
|
||||
internal const val ABI_EXTENSION_ASM_API_VERSION = Opcodes.ASM6
|
||||
internal const val ABI_EXTENSION_ASM_API_VERSION = Opcodes.API_VERSION
|
||||
+1
-1
@@ -314,7 +314,7 @@ private fun SignatureNode.split(
|
||||
}
|
||||
}
|
||||
|
||||
private class SignatureParserVisitor : SignatureVisitor(Opcodes.ASM5) {
|
||||
private class SignatureParserVisitor : SignatureVisitor(Opcodes.API_VERSION) {
|
||||
val root = SignatureNode(Root)
|
||||
private val stack = ArrayDeque<SignatureNode>(5).apply { add(root) }
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ package com.android.tools.klint.client.api;
|
||||
|
||||
import static com.android.SdkConstants.DOT_CLASS;
|
||||
import static com.android.SdkConstants.DOT_JAR;
|
||||
import static org.jetbrains.org.objectweb.asm.Opcodes.ASM5;
|
||||
import static org.jetbrains.org.objectweb.asm.Opcodes.API_VERSION;
|
||||
|
||||
import com.android.annotations.NonNull;
|
||||
import com.android.annotations.Nullable;
|
||||
@@ -319,7 +319,7 @@ class ClassEntry implements Comparable<ClassEntry> {
|
||||
private final Map<String, String> mMap;
|
||||
|
||||
public SuperclassVisitor(Map<String, String> map) {
|
||||
super(ASM5);
|
||||
super(API_VERSION);
|
||||
mMap = map;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -17,13 +17,13 @@ internal class BinAnnData(
|
||||
val args: ArrayList<BinAnnArgData> = arrayListOf()
|
||||
)
|
||||
|
||||
private class TemplateAnnotationVisitor(val anns: ArrayList<BinAnnData> = arrayListOf()) : AnnotationVisitor(Opcodes.ASM5) {
|
||||
private class TemplateAnnotationVisitor(val anns: ArrayList<BinAnnData> = arrayListOf()) : AnnotationVisitor(Opcodes.API_VERSION) {
|
||||
override fun visit(name: String?, value: Any?) {
|
||||
anns.last().args.add(BinAnnArgData(name, value.toString()))
|
||||
}
|
||||
}
|
||||
|
||||
private class TemplateClassVisitor(val annVisitor: TemplateAnnotationVisitor) : ClassVisitor(Opcodes.ASM5) {
|
||||
private class TemplateClassVisitor(val annVisitor: TemplateAnnotationVisitor) : ClassVisitor(Opcodes.API_VERSION) {
|
||||
override fun visitAnnotation(desc: String, visible: Boolean): AnnotationVisitor? {
|
||||
val shortName = Type.getType(desc).internalName.substringAfterLast("/")
|
||||
if (shortName.startsWith("KotlinScript") || shortName.startsWith("ScriptTemplate")) {
|
||||
|
||||
+3
-3
@@ -70,7 +70,7 @@ class MockApplicationCreationTracingInstrumenter(private val debugInfo: Boolean)
|
||||
predicate: (name: String, desc: String) -> Boolean,
|
||||
transform: (original: MethodVisitor) -> MethodVisitor
|
||||
): ClassVisitor {
|
||||
return object : ClassVisitor(Opcodes.ASM6, out) {
|
||||
return object : ClassVisitor(Opcodes.API_VERSION, out) {
|
||||
|
||||
var visited = false
|
||||
|
||||
@@ -95,7 +95,7 @@ class MockApplicationCreationTracingInstrumenter(private val debugInfo: Boolean)
|
||||
|
||||
private fun transformMockComponentManagerPicoContainer(out: ClassVisitor): ClassVisitor {
|
||||
return createMethodTransformClassVisitor(out, { name, _ -> name == "getComponentInstance" }) { original ->
|
||||
object : MethodVisitor(Opcodes.ASM6, original) {
|
||||
object : MethodVisitor(Opcodes.API_VERSION, original) {
|
||||
override fun visitCode() {
|
||||
super.visitCode()
|
||||
visitLabel(Label())
|
||||
@@ -115,7 +115,7 @@ class MockApplicationCreationTracingInstrumenter(private val debugInfo: Boolean)
|
||||
|
||||
private fun transformMockComponentManager(out: ClassVisitor): ClassVisitor {
|
||||
return createMethodTransformClassVisitor(out, { name, _ -> name == "<init>" }) { original ->
|
||||
object : MethodVisitor(Opcodes.ASM6, original) {
|
||||
object : MethodVisitor(Opcodes.API_VERSION, original) {
|
||||
override fun visitInsn(opcode: Int) {
|
||||
if (opcode == Opcodes.RETURN) {
|
||||
visitVarInsn(Opcodes.ALOAD, 0)
|
||||
|
||||
Reference in New Issue
Block a user