From 7981e5aa3a1987a922133d89ca00a1c5e726b77f Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Fri, 22 Jan 2016 17:25:09 +0300 Subject: [PATCH] Increase metadata version to 1.1, hardcode incompatibility with 1.0 Add a temporary option to suppress incompatibility errors when compiling Kotlin against current IDEA libraries until they are migrated --- .idea/kotlinc.xml | 2 +- .../src/org/jetbrains/kotlin/cli/jvm/K2JVMCompiler.kt | 5 +++++ .../jetbrains/kotlin/load/kotlin/JvmMetadataVersion.kt | 9 +++++++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml index 1fa0a13401d..ea56145a5ba 100644 --- a/.idea/kotlinc.xml +++ b/.idea/kotlinc.xml @@ -1,6 +1,6 @@ - \ No newline at end of file diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/K2JVMCompiler.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/K2JVMCompiler.kt index 30e0205f731..0a0697fcd9a 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/K2JVMCompiler.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/K2JVMCompiler.kt @@ -35,6 +35,7 @@ import org.jetbrains.kotlin.compiler.plugin.PluginCliOptionProcessingException import org.jetbrains.kotlin.compiler.plugin.cliPluginUsageString import org.jetbrains.kotlin.config.* import org.jetbrains.kotlin.load.java.JvmAbi +import org.jetbrains.kotlin.load.kotlin.JvmMetadataVersion import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCompilationComponents import org.jetbrains.kotlin.script.StandardScriptDefinition import org.jetbrains.kotlin.util.PerformanceCounter @@ -128,6 +129,10 @@ open class K2JVMCompiler : CLICompiler() { shouldReportPerf = false } + if (arguments.skipMetadataVersionCheck) { + JvmMetadataVersion.skipCheck = true + } + putAdvancedOptions(configuration, arguments) messageSeverityCollector.report(CompilerMessageSeverity.LOGGING, "Configuring the compilation environment", CompilerMessageLocation.NO_LOCATION) diff --git a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/kotlin/JvmMetadataVersion.kt b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/kotlin/JvmMetadataVersion.kt index b59aae68218..ca7904271ef 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/kotlin/JvmMetadataVersion.kt +++ b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/kotlin/JvmMetadataVersion.kt @@ -23,11 +23,16 @@ import org.jetbrains.kotlin.serialization.deserialization.BinaryVersion * This version includes the version of the core protobuf messages (descriptors.proto) as well as JVM extensions (jvm_descriptors.proto). */ class JvmMetadataVersion(vararg numbers: Int) : BinaryVersion(*numbers) { - override fun isCompatible() = this.isCompatibleTo(INSTANCE) + // NOTE: 1.1 is incompatible with 1.0 and hence with any other version except 1.1.* + override fun isCompatible() = + skipCheck || (this.major == 1 && this.minor == 1) companion object { + // TODO: this is a temporary hack which can be removed once we migrate the IDEA code from 1.0 to 1.1 + var skipCheck: Boolean = false + @JvmField - val INSTANCE = JvmMetadataVersion(1, 0, 2) + val INSTANCE = JvmMetadataVersion(1, 1, 0) @JvmField val INVALID_VERSION = JvmMetadataVersion()