Deprecate -Xuse-experimental #KT-47623 Fixed

This commit is contained in:
Mikhail Glukhikh
2021-07-07 12:03:03 +03:00
committed by teamcityserver
parent d9531f0c61
commit 195b6d1fb1
4 changed files with 12 additions and 2 deletions
@@ -18,6 +18,7 @@ package org.jetbrains.kotlin.cli.common.arguments
import com.intellij.util.xmlb.annotations.Transient
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.WARNING
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
import org.jetbrains.kotlin.config.*
import java.util.*
@@ -379,9 +380,13 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
val experimentalFqNames = experimental?.toList().orEmpty()
if (experimentalFqNames.isNotEmpty()) {
put(AnalysisFlags.experimental, experimentalFqNames)
collector.report(CompilerMessageSeverity.WARNING, "'-Xexperimental' is deprecated and will be removed in a future release")
collector.report(WARNING, "'-Xexperimental' is deprecated and will be removed in a future release")
}
put(AnalysisFlags.useExperimental, useExperimental?.toList().orEmpty() + optIn?.toList().orEmpty())
val useExperimentalFqNames = useExperimental?.toList().orEmpty()
if (useExperimentalFqNames.isNotEmpty()) {
collector.report(WARNING, "'-Xuse-experimental' is deprecated and will be removed in a future release")
}
put(AnalysisFlags.useExperimental, useExperimentalFqNames + optIn?.toList().orEmpty())
put(AnalysisFlags.expectActualLinker, expectActualLinker)
put(AnalysisFlags.explicitApiVersion, apiVersion != null)
put(AnalysisFlags.allowResultReturnType, allowResultReturnType)
@@ -4,3 +4,4 @@ $TEMP_DIR$
-Xopt-in=kotlin.RequiresOptIn
-Xopt-in=org.test.Warning1
-Xexperimental=org.test.Warning2
-Xuse-experimental=org.test.OneMore
@@ -9,3 +9,6 @@ annotation class Warning1
@RequiresOptIn
@Retention(AnnotationRetention.BINARY)
annotation class Warning2
@RequiresOptIn
annotation class OneMore
@@ -1,4 +1,5 @@
warning: '-Xexperimental' is deprecated and will be removed in a future release
warning: '-Xuse-experimental' is deprecated and will be removed in a future release
warning: opt-in requirement marker org.test.Warning2 is deprecated. Warning2
warning: opt-in requirement marker org.test.Warning1 is deprecated. Warning1
OK