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
This commit is contained in:
Alexander Udalov
2018-02-09 19:06:21 +01:00
parent 007248620c
commit a2835fe0d3
@@ -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())