Allow to read metadata 2.0 from version 1.8
This commit is contained in:
+3
-5
@@ -1,10 +1,8 @@
|
||||
error: incompatible classes were found in dependencies. Remove them from the classpath or use '-Xskip-metadata-version-check' to suppress errors
|
||||
$TMP_DIR$/library.jar!/META-INF/main.kotlin_module: error: module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 2.0.0, expected version is $ABI_VERSION$.
|
||||
compiler/testData/compileKotlinAgainstCustomBinaries/oldJvmAgainstFir/source.kt:4:5: error: unresolved reference: get
|
||||
error: pre-release classes were found in dependencies. Remove them from the classpath, recompile with a release compiler or use '-Xskip-prerelease-check' to suppress errors
|
||||
compiler/testData/compileKotlinAgainstCustomBinaries/oldJvmAgainstFir/source.kt:4:5: error: class 'lib.AKt' is compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler
|
||||
get { Box("OK").value }
|
||||
^
|
||||
compiler/testData/compileKotlinAgainstCustomBinaries/oldJvmAgainstFir/source.kt:4:11: error: class 'lib.Box' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 2.0.0, expected version is $ABI_VERSION$.
|
||||
The class is loaded from $TMP_DIR$/library.jar!/lib/Box.class
|
||||
compiler/testData/compileKotlinAgainstCustomBinaries/oldJvmAgainstFir/source.kt:4:11: error: class 'lib.Box' is compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler
|
||||
get { Box("OK").value }
|
||||
^
|
||||
COMPILATION_ERROR
|
||||
|
||||
Vendored
+8
-1
@@ -1 +1,8 @@
|
||||
OK
|
||||
error: pre-release classes were found in dependencies. Remove them from the classpath, recompile with a release compiler or use '-Xskip-prerelease-check' to suppress errors
|
||||
compiler/testData/compileKotlinAgainstCustomBinaries/oldJvmAgainstFirWithStableAbi/source.kt:4:5: error: class 'lib.AKt' is compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler
|
||||
get { Box("OK").value }
|
||||
^
|
||||
compiler/testData/compileKotlinAgainstCustomBinaries/oldJvmAgainstFirWithStableAbi/source.kt:4:11: error: class 'lib.Box' is compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler
|
||||
get { Box("OK").value }
|
||||
^
|
||||
COMPILATION_ERROR
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package lib
|
||||
|
||||
class Box(val value: String)
|
||||
|
||||
inline fun <T> get(block: () -> T): T = block()
|
||||
+1
@@ -0,0 +1 @@
|
||||
OK
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
import lib.*
|
||||
|
||||
fun main() {
|
||||
get { Box("OK").value }
|
||||
}
|
||||
+5
-2
@@ -697,12 +697,15 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration
|
||||
}
|
||||
|
||||
fun testOldJvmAgainstFirWithStableAbi() {
|
||||
// TODO: looks like now it's not possible to compile library with version 2.0 to be able to compile against it without additional flags
|
||||
// Should we delete this test?
|
||||
val library = compileLibrary("library", additionalOptions = listOf("-language-version", "2.0", "-Xabi-stability=stable"))
|
||||
compileKotlin("source.kt", tmpdir, listOf(library))
|
||||
}
|
||||
|
||||
fun testOldJvmAgainstFirWithStableAbiAndNoPrereleaseCheck() {
|
||||
val library = compileLibrary("library", additionalOptions = listOf("-language-version", "2.0", "-Xabi-stability=stable"))
|
||||
compileKotlin("source.kt", tmpdir, listOf(library), additionalOptions = listOf("-Xskip-prerelease-check"))
|
||||
}
|
||||
|
||||
fun testOldJvmAgainstFirWithAllowUnstableDependencies() {
|
||||
val library = compileLibrary("library", additionalOptions = listOf("-language-version", "2.0"))
|
||||
compileKotlin("source.kt", tmpdir, listOf(library), additionalOptions = listOf("-Xallow-unstable-dependencies", "-Xskip-metadata-version-check"))
|
||||
|
||||
+2
@@ -19,6 +19,8 @@ class JvmMetadataVersion(versionArray: IntArray, val isStrictSemantics: Boolean)
|
||||
}
|
||||
|
||||
fun isCompatible(metadataVersionFromLanguageVersion: JvmMetadataVersion): Boolean {
|
||||
// Special case for bootstrap: 1.8 can read 2.0
|
||||
if (major == 2 && minor == 0 && INSTANCE.major == 1 && INSTANCE.minor == 8) return true
|
||||
// * Compiler of deployVersion X (INSTANCE) with LV Y (metadataVersionFromLanguageVersion)
|
||||
// * can read metadata with version <= max(X+1, Y)
|
||||
val forwardCompatibility = if (isStrictSemantics) INSTANCE else INSTANCE_NEXT
|
||||
|
||||
Reference in New Issue
Block a user