From 9c9219b285f464c9a49f9dd54c9f6d89ad17b275 Mon Sep 17 00:00:00 2001 From: Mikhail Zarechenskiy Date: Tue, 20 Apr 2021 14:23:24 +0300 Subject: [PATCH] [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 --- .../jps/build/AsmVersionForJpsBuildTest.kt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 jps/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AsmVersionForJpsBuildTest.kt diff --git a/jps/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AsmVersionForJpsBuildTest.kt b/jps/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AsmVersionForJpsBuildTest.kt new file mode 100644 index 00000000000..b6564c4068e --- /dev/null +++ b/jps/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AsmVersionForJpsBuildTest.kt @@ -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) + } +} \ No newline at end of file