Replace -Xuse-experimental with -Xopt-in in codebase

This commit is contained in:
Mikhail Glukhikh
2021-07-07 15:41:04 +03:00
committed by teamcityserver
parent 195b6d1fb1
commit 47c8bab48e
7 changed files with 12 additions and 17 deletions
@@ -314,8 +314,8 @@ class ExperimentalUsageChecker(project: Project) : CallChecker {
reportError: (String) -> Unit,
reportWarning: (String) -> Unit
) {
// Ideally, we should run full resolution (with all classifier usage checkers) on classifiers used in "-Xexperimental" and
// "-Xuse-experimental" arguments. However, it's not easy to do this. This should be solved in the future with the support of
// Ideally, we should run full resolution (with all classifier usage checkers) on classifiers used in
// "-Xopt-in" arguments. However, it's not easy to do this. This should be solved in the future with the support of
// module annotations. For now, we only check deprecations because this is needed to correctly retire unneeded compiler arguments.
val deprecationResolver = DeprecationResolver(
LockBasedStorageManager("ExperimentalUsageChecker"),
@@ -72,8 +72,7 @@ sourceSets.main.get().java.srcDir("src/jvm/kotlin")
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions {
freeCompilerArgs = listOf("-Xuse-experimental=kotlin.ExperimentalUnsignedTypes",
"-Xuse-experimental=kotlin.Experimental",
freeCompilerArgs = listOf("-Xopt-in=kotlin.ExperimentalUnsignedTypes",
"-Xopt-in=kotlin.RequiresOptIn",
"-Xinline-classes",
"-Xskip-prerelease-check")
@@ -15,7 +15,7 @@ import kotlin.annotation.AnnotationTarget.*
*
* Any usage of a declaration annotated with `@ExperimentalCli` must be accepted either by
* annotating that usage with the [UseExperimental] annotation, e.g. `@UseExperimental(ExperimentalCli::class)`,
* or by using the compiler argument `-Xuse-experimental=kotlinx.cli.ExperimentalCli`.
* or by using the compiler argument `-Xopt-in=kotlinx.cli.ExperimentalCli`.
*/
@RequiresOptIn("This API is experimental. It may be changed in the future without notice.", RequiresOptIn.Level.WARNING)
@Retention(AnnotationRetention.BINARY)
+2 -3
View File
@@ -50,9 +50,8 @@ tasks.withType<KotlinCompile<*>>().configureEach {
kotlinOptions.freeCompilerArgs += listOf(
"-Xallow-kotlin-package",
"-Xallow-result-return-type",
"-Xuse-experimental=kotlin.Experimental",
"-Xuse-experimental=kotlin.ExperimentalMultiplatform",
"-Xuse-experimental=kotlin.contracts.ExperimentalContracts",
"-Xopt-in=kotlin.ExperimentalMultiplatform",
"-Xopt-in=kotlin.contracts.ExperimentalContracts",
"-Xinline-classes"
)
}
@@ -122,9 +122,8 @@ tasks.withType<KotlinCompile<*>> {
kotlinOptions.freeCompilerArgs += listOf(
"-Xallow-kotlin-package",
"-Xallow-result-return-type",
"-Xuse-experimental=kotlin.Experimental",
"-Xuse-experimental=kotlin.ExperimentalMultiplatform",
"-Xuse-experimental=kotlin.contracts.ExperimentalContracts",
"-Xopt-in=kotlin.ExperimentalMultiplatform",
"-Xopt-in=kotlin.contracts.ExperimentalContracts",
"-Xinline-classes",
"-Xopt-in=kotlin.RequiresOptIn",
"-Xopt-in=kotlin.ExperimentalUnsignedTypes",
+2 -3
View File
@@ -138,9 +138,8 @@ tasks.withType<KotlinCompile<*>>().configureEach {
kotlinOptions.freeCompilerArgs += listOf(
"-Xallow-kotlin-package",
"-Xallow-result-return-type",
"-Xuse-experimental=kotlin.Experimental",
"-Xuse-experimental=kotlin.ExperimentalMultiplatform",
"-Xuse-experimental=kotlin.contracts.ExperimentalContracts",
"-Xopt-in=kotlin.ExperimentalMultiplatform",
"-Xopt-in=kotlin.contracts.ExperimentalContracts",
"-Xinline-classes",
"-Xopt-in=kotlin.RequiresOptIn",
"-Xopt-in=kotlin.ExperimentalUnsignedTypes",
+2 -3
View File
@@ -74,9 +74,8 @@ tasks.withType<KotlinCompile<*>>().configureEach {
kotlinOptions.freeCompilerArgs += listOf(
"-Xallow-kotlin-package",
"-Xallow-result-return-type",
"-Xuse-experimental=kotlin.Experimental",
"-Xuse-experimental=kotlin.ExperimentalMultiplatform",
"-Xuse-experimental=kotlin.contracts.ExperimentalContracts",
"-Xopt-in=kotlin.ExperimentalMultiplatform",
"-Xopt-in=kotlin.contracts.ExperimentalContracts",
"-Xinline-classes",
"-Xopt-in=kotlin.RequiresOptIn",
"-Xopt-in=kotlin.ExperimentalUnsignedTypes",