diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt index c216740d63e..695a0523831 100644 --- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt +++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt @@ -328,7 +328,11 @@ abstract class CommonCompilerArguments : CommonToolArguments() { return HashMap, Any>().apply { put(AnalysisFlags.skipMetadataVersionCheck, skipMetadataVersionCheck) put(AnalysisFlags.multiPlatformDoNotCheckActual, noCheckActual) - put(AnalysisFlags.experimental, experimental?.toList().orEmpty()) + 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") + } put(AnalysisFlags.useExperimental, useExperimental?.toList().orEmpty()) put(AnalysisFlags.explicitApiVersion, apiVersion != null) put(AnalysisFlags.allowResultReturnType, allowResultReturnType) diff --git a/compiler/testData/cli/jvm/experimentalDeprecatedWarning.out b/compiler/testData/cli/jvm/experimentalDeprecatedWarning.out index f03ea066f9d..2e39236cf86 100644 --- a/compiler/testData/cli/jvm/experimentalDeprecatedWarning.out +++ b/compiler/testData/cli/jvm/experimentalDeprecatedWarning.out @@ -1,3 +1,4 @@ +warning: '-Xexperimental' is deprecated and will be removed in a future release warning: experimental API marker org.test.Warning2 is deprecated. Warning2 warning: experimental API marker org.test.Warning1 is deprecated. Warning1 OK diff --git a/compiler/testData/cli/jvm/experimentalIsNotAnnotation.out b/compiler/testData/cli/jvm/experimentalIsNotAnnotation.out index dccfb74f371..6dfe842009e 100644 --- a/compiler/testData/cli/jvm/experimentalIsNotAnnotation.out +++ b/compiler/testData/cli/jvm/experimentalIsNotAnnotation.out @@ -1,3 +1,4 @@ +warning: '-Xexperimental' is deprecated and will be removed in a future release warning: class org.test.NotAnAnnotation1 is not an experimental API marker annotation warning: class org.test.NotAnAnnotation2 is not an experimental API marker annotation OK diff --git a/compiler/testData/cli/jvm/experimentalIsNotMarker.out b/compiler/testData/cli/jvm/experimentalIsNotMarker.out index 3e1f6f20f70..9b1b17a0e60 100644 --- a/compiler/testData/cli/jvm/experimentalIsNotMarker.out +++ b/compiler/testData/cli/jvm/experimentalIsNotMarker.out @@ -1,3 +1,4 @@ +warning: '-Xexperimental' is deprecated and will be removed in a future release warning: class org.test.NotAMarker1 is not an experimental API marker annotation warning: class org.test.NotAMarker2 is not an experimental API marker annotation OK diff --git a/compiler/testData/cli/jvm/experimentalNested.out b/compiler/testData/cli/jvm/experimentalNested.out index d86bac9de59..87440efb4ef 100644 --- a/compiler/testData/cli/jvm/experimentalNested.out +++ b/compiler/testData/cli/jvm/experimentalNested.out @@ -1 +1,2 @@ +warning: '-Xexperimental' is deprecated and will be removed in a future release OK diff --git a/compiler/testData/cli/jvm/experimentalUnresolved.out b/compiler/testData/cli/jvm/experimentalUnresolved.out index d58c03bb63e..d2ede251b56 100644 --- a/compiler/testData/cli/jvm/experimentalUnresolved.out +++ b/compiler/testData/cli/jvm/experimentalUnresolved.out @@ -1,3 +1,4 @@ +warning: '-Xexperimental' is deprecated and will be removed in a future release warning: experimental API marker org.test.Unresolved2 is unresolved. Please make sure it's present in the module dependencies warning: experimental API marker org.test.Unresolved1 is unresolved. Please make sure it's present in the module dependencies warning: experimental API marker org.test.Unresolved3 is unresolved. Please make sure it's present in the module dependencies