Provide a separate class for representing metadata version in kotlinx-metadata

Separate class allows encapsulating comparison, equality, and structure of version parts.
It also makes more sense from API standpoint than plain `IntArray`.
This commit is contained in:
Leonid Startsev
2023-11-08 12:56:05 +01:00
committed by Space Team
parent f101e5a336
commit 721af75f40
16 changed files with 323 additions and 89 deletions
@@ -6,6 +6,7 @@
package org.jetbrains.kotlin.jvm.abi
import kotlinx.metadata.*
import kotlinx.metadata.jvm.JvmMetadataVersion
import kotlinx.metadata.jvm.KotlinClassMetadata
import kotlinx.metadata.jvm.Metadata
import kotlinx.metadata.jvm.localDelegatedProperties
@@ -46,7 +47,7 @@ fun abiMetadataProcessor(annotationVisitor: AnnotationVisitor): AnnotationVisito
// TODO: maybe jvm-abi-gen should throw this exception by default, and not only in tests.
if (System.getProperty("idea.is.unit.test").toBoolean()) {
val actual = "${metadataVersion[0]}.${metadataVersion[1]}"
val expected = KotlinClassMetadata.COMPATIBLE_METADATA_VERSION.let { "${it[0]}.${it[1]}" }
val expected = JvmMetadataVersion.CURRENT.toString()
throw AssertionError(
"jvm-abi-gen can't process class file with the new metadata version because the version of kotlinx-metadata-jvm " +
"it depends on is too old.\n" +