Support -Xsuppress-version-warnings to suppress API/language version warnings

To be used in the project after bootstrap to get rid of warnings like
"Language version 1.3 is deprecated, ..." which prevent us from enabling
`-Werror` in `:compiler:cli` and other modules.
This commit is contained in:
Alexander Udalov
2021-02-02 14:23:39 +01:00
parent d901ceb734
commit bd45a6c11d
3 changed files with 15 additions and 4 deletions
@@ -351,6 +351,12 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
)
var inferenceCompatibility: Boolean by FreezableVar(false)
@Argument(
value = "-Xsuppress-version-warnings",
description = "Suppress warnings about outdated, inconsistent or experimental language or API versions"
)
var suppressVersionWarnings: Boolean by FreezableVar(false)
open fun configureAnalysisFlags(collector: MessageCollector): MutableMap<AnalysisFlag<*>, Any> {
return HashMap<AnalysisFlag<*>, Any>().apply {
put(AnalysisFlags.skipMetadataVersionCheck, skipMetadataVersionCheck)
@@ -496,9 +502,6 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
val apiVersion = parseVersion(collector, apiVersion, "API") ?: languageVersion
checkApiVersionIsNotGreaterThenLanguageVersion(languageVersion, apiVersion, collector)
checkLanguageVersionIsStable(languageVersion, collector)
checkOutdatedVersions(languageVersion, apiVersion, collector)
checkProgressiveMode(languageVersion, collector)
val languageVersionSettings = LanguageVersionSettingsImpl(
languageVersion,
@@ -507,7 +510,13 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
configureLanguageFeatures(collector)
)
checkIrSupport(languageVersionSettings, collector)
if (!suppressVersionWarnings) {
checkLanguageVersionIsStable(languageVersion, collector)
checkOutdatedVersions(languageVersion, apiVersion, collector)
checkProgressiveMode(languageVersion, collector)
checkIrSupport(languageVersionSettings, collector)
}
return languageVersionSettings
}
+1
View File
@@ -71,6 +71,7 @@ where advanced options include:
-Xreport-perf Report detailed performance statistics
-Xskip-metadata-version-check Allow to load classes with bad metadata version and pre-release classes
-Xskip-prerelease-check Allow to load pre-release classes
-Xsuppress-version-warnings Suppress warnings about outdated, inconsistent or experimental language or API versions
-Xuse-experimental=<fq.name> Enable, but don't propagate usages of experimental API for marker annotation with the given fully qualified name
-Xuse-fir Compile using Front-end IR. Warning: this feature is far from being production-ready
-Xuse-fir-extended-checkers Use extended analysis mode based on Front-end IR. Warning: this feature is far from being production-ready
+1
View File
@@ -179,6 +179,7 @@ where advanced options include:
-Xreport-perf Report detailed performance statistics
-Xskip-metadata-version-check Allow to load classes with bad metadata version and pre-release classes
-Xskip-prerelease-check Allow to load pre-release classes
-Xsuppress-version-warnings Suppress warnings about outdated, inconsistent or experimental language or API versions
-Xuse-experimental=<fq.name> Enable, but don't propagate usages of experimental API for marker annotation with the given fully qualified name
-Xuse-fir Compile using Front-end IR. Warning: this feature is far from being production-ready
-Xuse-fir-extended-checkers Use extended analysis mode based on Front-end IR. Warning: this feature is far from being production-ready