Use correct class file version when copying anonymous objects in inliner
Generally, using state.classFileVersion would be enough because we report an error when inlining bytecode into a class file with a lower target version (see INLINE_FROM_HIGHER_PLATFORM). However, we take maxOf with the original version of the class file, _just in case_ the user has suppressed this error (for example, to workaround some other corner case in the compiler). #KT-30744 Fixed
This commit is contained in:
+8
@@ -588,6 +588,14 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration
|
||||
)
|
||||
}
|
||||
|
||||
fun testInlineAnonymousObjectWithDifferentTarget() {
|
||||
val library = compileLibrary("library", additionalOptions = listOf("-jvm-target", "1.6"))
|
||||
compileKotlin("source.kt", tmpdir, listOf(library), additionalOptions = listOf("-jvm-target", "1.8"))
|
||||
val classLoader =
|
||||
URLClassLoader(arrayOf(library.toURI().toURL(), tmpdir.toURI().toURL()), ForTestCompileRuntime.runtimeJarClassLoader())
|
||||
classLoader.loadClass("SourceKt").getDeclaredMethod("main").invoke(null)
|
||||
}
|
||||
|
||||
companion object {
|
||||
// compiler before 1.1.4 version did not include suspension marks into bytecode.
|
||||
private fun stripSuspensionMarksToImitateLegacyCompiler(bytes: ByteArray): Pair<ByteArray, Int> {
|
||||
|
||||
Reference in New Issue
Block a user