From a2835fe0d3266d815dc805e2f628b17d1f2d85a4 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Fri, 9 Feb 2018 19:06:21 +0100 Subject: [PATCH] Do not report old runtime warnings for unstable API version These warnings are technically correct but are too noisy and have little value in case a user explicitly specifies unstable API version: it's unlikely that seeing these warnings, the user will choose to rollback to an earlier API version, since new API is probably one of the reasons that user specified that unstable version to begin with. So, in "kotlinc -language-version 1.3 -api-version 1.3 -cp kotlin-stdlib-1.2.jar", we will no longer report a warning that the attached stdlib has a version older than explicit API version (so long as 1.3 remains unstable). Note that we _could_ have reported these warnings in "kotlinc -language-version 1.3 -cp kotlin-stdlib-1.2.jar", because in this case the user might've not even be concerned with the new API in 1.3 and was only looking for new language features. However, we still think that it'd be unnecessary and one opt-in to the experimental world (with LV=1.3 in this case) is enough #KT-22777 Fixed --- .../jvm/JvmRuntimeVersionsConsistencyChecker.kt | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 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 795aff41bf7..4090f355d34 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/JvmRuntimeVersionsConsistencyChecker.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/JvmRuntimeVersionsConsistencyChecker.kt @@ -107,7 +107,8 @@ object JvmRuntimeVersionsConsistencyChecker { val consistency = checkCompilerClasspathConsistency(messageCollector, currentApi.version, runtimeJarsInfo) if (consistency is ClasspathConsistency.InconsistentWithApiVersion) { val actualRuntimeVersion = consistency.actualRuntimeVersion - messageCollector.issue( + if (currentApi.isStable) { + messageCollector.issue( null, "Runtime JAR files in the classpath have the version $actualRuntimeVersion, " + "which is older than the API version ${currentApi.version}. " + @@ -115,13 +116,14 @@ object JvmRuntimeVersionsConsistencyChecker { "explicitly to restrict the available APIs to the runtime of version $actualRuntimeVersion. " + "You can also pass '-language-version $actualRuntimeVersion' instead, which will restrict " + "not only the APIs to the specified version, but also the language features" - ) - - for (jar in consistency.incompatibleJars) { - messageCollector.issue( - jar.file, - "Runtime JAR file has version ${jar.version} which is older than required for API version ${currentApi.version}" ) + + for (jar in consistency.incompatibleJars) { + messageCollector.issue( + jar.file, + "Runtime JAR file has version ${jar.version} which is older than required for API version ${currentApi.version}" + ) + } } val actualApi = ApiVersion.parse(actualRuntimeVersion.toString())