From 57f8ef372fa8f47b858d9e6a94354ec527f744e4 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Fri, 3 Feb 2017 15:00:52 +0300 Subject: [PATCH] Report different runtime versions earlier than incompatibility with API version Previously if you had kotlin-reflect 1.0 and kotlin-runtime 1.1 in the classpath, checkCompatibleWithApiVersion was invoked first, and an error was reported that suggested to pass "-api-version" to the compiler. However, no correct "-api-version" can be passed in this case, because checkMatchingVersions would then report that the two libraries have different versions anyway. So, now we first ensure that all libraries have the same version, and only then do check if the version is correct --- .../cli/jvm/JvmRuntimeVersionsConsistencyChecker.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/JvmRuntimeVersionsConsistencyChecker.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/JvmRuntimeVersionsConsistencyChecker.kt index 213c202278b..f8b20389668 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/JvmRuntimeVersionsConsistencyChecker.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/JvmRuntimeVersionsConsistencyChecker.kt @@ -176,14 +176,14 @@ object JvmRuntimeVersionsConsistencyChecker { checkNotNewerThanCompiler(messageCollector, it) }.any { it }) return ClasspathConsistency.InconsistentWithCompilerVersion - if (runtimeJarsInfo.jars.map { - checkCompatibleWithApiVersion(messageCollector, it, apiVersion) - }.any { it }) return ClasspathConsistency.InconsistentWithApiVersion - if (checkMatchingVersions(messageCollector, runtimeJarsInfo)) { return ClasspathConsistency.InconsistentBecauseOfRuntimesWithDifferentVersions } + if (runtimeJarsInfo.jars.map { + checkCompatibleWithApiVersion(messageCollector, it, apiVersion) + }.any { it }) return ClasspathConsistency.InconsistentWithApiVersion + return ClasspathConsistency.Consistent }