Update JVM metadata version to 1.4.0
This commit is contained in:
+3
-4
@@ -20,14 +20,13 @@ class JvmMetadataVersion(versionArray: IntArray, val isStrictSemantics: Boolean)
|
||||
if (isStrictSemantics) {
|
||||
isCompatibleTo(INSTANCE)
|
||||
} else {
|
||||
// In Kotlin 1.4, JVM metadata version is going to be advanced to 1.4.0.
|
||||
// Kotlin 1.3 is able to read metadata of versions up to Kotlin 1.4 (unless the version has strict semantics).
|
||||
major == 1 && minor <= 4
|
||||
// Kotlin 1.N is able to read metadata of versions up to Kotlin 1.{N+1} (unless the version has strict semantics).
|
||||
major == INSTANCE.major && minor <= INSTANCE.minor + 1
|
||||
}
|
||||
|
||||
companion object {
|
||||
@JvmField
|
||||
val INSTANCE = JvmMetadataVersion(1, 1, 17)
|
||||
val INSTANCE = JvmMetadataVersion(1, 4, 0)
|
||||
|
||||
@JvmField
|
||||
val INVALID_VERSION = JvmMetadataVersion()
|
||||
|
||||
+9
-7
@@ -33,12 +33,19 @@ class ModuleMapping private constructor(
|
||||
|
||||
const val STRICT_METADATA_VERSION_SEMANTICS_FLAG = 1 shl 0
|
||||
|
||||
fun readVersionNumber(stream: DataInputStream): IntArray? =
|
||||
try {
|
||||
IntArray(stream.readInt()) { stream.readInt() }
|
||||
} catch (e: IOException) {
|
||||
null
|
||||
}
|
||||
|
||||
fun loadModuleMapping(
|
||||
bytes: ByteArray?,
|
||||
debugName: String,
|
||||
skipMetadataVersionCheck: Boolean,
|
||||
isJvmPackageNameSupported: Boolean,
|
||||
reportIncompatibleVersionError: (JvmMetadataVersion) -> Unit
|
||||
reportIncompatibleVersionError: (JvmMetadataVersion) -> Unit,
|
||||
): ModuleMapping {
|
||||
if (bytes == null) {
|
||||
return EMPTY
|
||||
@@ -46,12 +53,7 @@ class ModuleMapping private constructor(
|
||||
|
||||
val stream = DataInputStream(ByteArrayInputStream(bytes))
|
||||
|
||||
val versionNumber = try {
|
||||
IntArray(stream.readInt()) { stream.readInt() }
|
||||
} catch (e: IOException) {
|
||||
return CORRUPTED
|
||||
}
|
||||
|
||||
val versionNumber = readVersionNumber(stream) ?: return CORRUPTED
|
||||
val preVersion = JvmMetadataVersion(*versionNumber)
|
||||
if (!skipMetadataVersionCheck && !preVersion.isCompatible()) {
|
||||
reportIncompatibleVersionError(preVersion)
|
||||
|
||||
Reference in New Issue
Block a user