CompatibilityMode cleanup
Review: https://jetbrains.team/p/kt/reviews/8401 - Drop unused variables - Replace `assert` with `require` because `assert` isn't reliable which makes hard to do any judgements about the code (`-ea` flag must be passed to the VM for the `assert` to be active. And it's hard to know when we the flag is passed). If `assert` was here for the performance reasons then a comment should have been left. - Add the assert message for clearity Because I'm evaluating what will break if KotlinAbiVersion is bumped. And when the code around KotlinAbiVersion is clean it's easier to do the evaluation.
This commit is contained in:
+5
-6
@@ -13,6 +13,7 @@ import org.jetbrains.kotlin.ir.symbols.*
|
||||
import org.jetbrains.kotlin.ir.util.IdSignature
|
||||
import org.jetbrains.kotlin.library.IrLibrary
|
||||
import org.jetbrains.kotlin.library.KotlinAbiVersion
|
||||
import org.jetbrains.kotlin.library.KotlinLibraryProperResolverWithAttributes
|
||||
|
||||
fun IrSymbol.kind(): BinarySymbolData.SymbolKind {
|
||||
return when (this) {
|
||||
@@ -31,7 +32,9 @@ fun IrSymbol.kind(): BinarySymbolData.SymbolKind {
|
||||
class CompatibilityMode(val abiVersion: KotlinAbiVersion) {
|
||||
|
||||
init {
|
||||
assert(abiVersion.isCompatible())
|
||||
require(abiVersion.isCompatible()) {
|
||||
"Incompatible KLIB should have been discarded in ${KotlinLibraryProperResolverWithAttributes<Nothing>::libraryMatch.name}"
|
||||
}
|
||||
}
|
||||
|
||||
val oldSignatures: Boolean
|
||||
@@ -44,11 +47,7 @@ class CompatibilityMode(val abiVersion: KotlinAbiVersion) {
|
||||
|
||||
companion object {
|
||||
val LAST_PRIVATE_SIG_ABI_VERSION = KotlinAbiVersion(1, 5, 0)
|
||||
|
||||
val WITH_PRIVATE_SIG = CompatibilityMode(LAST_PRIVATE_SIG_ABI_VERSION)
|
||||
val WITH_COMMON_SIG = CompatibilityMode(KotlinAbiVersion.CURRENT)
|
||||
|
||||
val CURRENT = WITH_COMMON_SIG
|
||||
val CURRENT = CompatibilityMode(KotlinAbiVersion.CURRENT)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user