[CHERRY PICKED FROM IJ] KTIJ-7656 Add test to check ASM version of the bundled compiler

The original issue was fixed by using the correct version of the compiler in https://github.com/JetBrains/intellij-kotlin/commit/9695fdcd07f7fcea1ea96030af4106b5a89cd007. This version of the compiler was built against 202 bunch that contains ASM8, the previous one was erroneously built against 201 with ASM7.

 Note that currently it's not trivial to write functional test because we need Java 15 for it

GitOrigin-RevId: 900410b89902a6a33d8e2285fe24806cd671dff6
Original commit: https://github.com/JetBrains/intellij-community/commit/e6cfeda5839ef1789b94d20b7435a1d2a867e2c4
This commit is contained in:
Mikhail Zarechenskiy
2021-04-20 14:23:24 +03:00
committed by Nikita Bobko
parent 8f6722a1fd
commit 9c9219b285
@@ -0,0 +1,16 @@
package org.jetbrains.kotlin.jps.build
import junit.framework.TestCase
import org.jetbrains.kotlin.codegen.AbstractClassBuilder
import org.jetbrains.org.objectweb.asm.Opcodes
import org.jetbrains.org.objectweb.asm.RecordComponentVisitor
class AsmVersionForJpsBuildTest : TestCase() {
// Kotlin compiler contains some version of ASM that is taken from a particular platform dependency
fun testAsmVersionForBundledKotlinCompiler() {
val field = RecordComponentVisitor::class.java.getDeclaredField("api").also { it.trySetAccessible() }
val asmVersionForBundledCompiler = field.getInt(AbstractClassBuilder.EMPTY_RECORD_VISITOR)
assertEquals(Opcodes.ASM8, asmVersionForBundledCompiler)
}
}