Use last asm api for visitor construction

This commit is contained in:
Mikhael Bogdanov
2018-12-19 10:23:15 +01:00
parent c2837cf7d9
commit c19c979b7d
44 changed files with 93 additions and 93 deletions
@@ -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)
@@ -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
}
@@ -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();
@@ -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
@@ -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,