Use -opt-in instead of -Xopt-in in comments and scripts

This commit is contained in:
Mikhail Glukhikh
2021-09-06 14:19:51 +03:00
parent 8ad540953e
commit ffbd574a08
30 changed files with 80 additions and 80 deletions
@@ -327,7 +327,7 @@ class ExperimentalUsageChecker(project: Project) : CallChecker {
reportWarning: (String) -> Unit reportWarning: (String) -> Unit
) { ) {
// Ideally, we should run full resolution (with all classifier usage checkers) on classifiers used in // 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 // "-opt-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. // module annotations. For now, we only check deprecations because this is needed to correctly retire unneeded compiler arguments.
val deprecationResolver = DeprecationResolver( val deprecationResolver = DeprecationResolver(
LockBasedStorageManager("ExperimentalUsageChecker"), LockBasedStorageManager("ExperimentalUsageChecker"),
@@ -56,7 +56,7 @@ fun <R> Function<R>.reflect(): KFunction<R>? {
* *
* Any usage of a declaration annotated with `@ExperimentalReflectionOnLambdas` should be accepted either by * Any usage of a declaration annotated with `@ExperimentalReflectionOnLambdas` should be accepted either by
* annotating that usage with the [OptIn] annotation, e.g. `@OptIn(ExperimentalReflectionOnLambdas::class)`, * annotating that usage with the [OptIn] annotation, e.g. `@OptIn(ExperimentalReflectionOnLambdas::class)`,
* or by using the compiler argument `-Xopt-in=kotlin.reflect.jvm.ExperimentalReflectionOnLambdas`. * or by using the compiler argument `-opt-in=kotlin.reflect.jvm.ExperimentalReflectionOnLambdas`.
*/ */
@RequiresOptIn(level = RequiresOptIn.Level.WARNING) @RequiresOptIn(level = RequiresOptIn.Level.WARNING)
@Retention(AnnotationRetention.BINARY) @Retention(AnnotationRetention.BINARY)
@@ -41,7 +41,7 @@ dependencies {
compileKotlin { compileKotlin {
kotlinOptions { kotlinOptions {
freeCompilerArgs = ['-Xopt-in=kotlin.ExperimentalUnsignedTypes', '-Xskip-metadata-version-check'] freeCompilerArgs = ['-opt-in=kotlin.ExperimentalUnsignedTypes', '-Xskip-metadata-version-check']
allWarningsAsErrors=true allWarningsAsErrors=true
} }
} }
+6 -6
View File
@@ -36,7 +36,7 @@ sourceSets {
compileCompilerKotlin { compileCompilerKotlin {
kotlinOptions.jvmTarget = "1.8" kotlinOptions.jvmTarget = "1.8"
kotlinOptions.allWarningsAsErrors=true kotlinOptions.allWarningsAsErrors=true
kotlinOptions.freeCompilerArgs += ['-Xopt-in=kotlin.RequiresOptIn', '-Xopt-in=org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI', '-Xskip-prerelease-check'] kotlinOptions.freeCompilerArgs += ['-opt-in=kotlin.RequiresOptIn', '-opt-in=org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI', '-Xskip-prerelease-check']
} }
compileCli_bcKotlin { compileCli_bcKotlin {
@@ -185,11 +185,11 @@ targetList.each { target ->
args = [*konanArgs, args = [*konanArgs,
'-output', project(':kotlin-native:runtime').file("build/${target}Stdlib"), '-output', project(':kotlin-native:runtime').file("build/${target}Stdlib"),
'-produce', 'library', '-module-name', 'stdlib', '-produce', 'library', '-module-name', 'stdlib',
'-Xmulti-platform', '-Xopt-in=kotlin.RequiresOptIn', '-Xmulti-platform', '-opt-in=kotlin.RequiresOptIn',
'-Xopt-in=kotlin.contracts.ExperimentalContracts', '-opt-in=kotlin.contracts.ExperimentalContracts',
'-Xopt-in=kotlin.ExperimentalMultiplatform', '-opt-in=kotlin.ExperimentalMultiplatform',
'-Xopt-in=kotlin.native.internal.InternalForKotlinNative', '-opt-in=kotlin.native.internal.InternalForKotlinNative',
'-Xopt-in=kotlin.native.SymbolNameIsDeprecated', '-opt-in=kotlin.native.SymbolNameIsDeprecated',
*commonSrc.toList(), *commonSrc.toList(),
*testAnnotationCommon.toList(), *testAnnotationCommon.toList(),
*testCommon.toList(), *testCommon.toList(),
+12 -12
View File
@@ -873,14 +873,14 @@ standaloneTest("cleaner_basic") {
enabled = (project.testTarget != 'wasm32') && // Cleaners need workers enabled = (project.testTarget != 'wasm32') && // Cleaners need workers
!isNoopGC !isNoopGC
source = "runtime/basic/cleaner_basic.kt" source = "runtime/basic/cleaner_basic.kt"
flags = ['-tr', '-Xopt-in=kotlin.native.internal.InternalForKotlinNative'] flags = ['-tr', '-opt-in=kotlin.native.internal.InternalForKotlinNative']
} }
standaloneTest("cleaner_workers") { standaloneTest("cleaner_workers") {
enabled = (project.testTarget != 'wasm32') && // Cleaners need workers enabled = (project.testTarget != 'wasm32') && // Cleaners need workers
!isNoopGC !isNoopGC
source = "runtime/basic/cleaner_workers.kt" source = "runtime/basic/cleaner_workers.kt"
flags = ['-tr', '-Xopt-in=kotlin.native.internal.InternalForKotlinNative'] flags = ['-tr', '-opt-in=kotlin.native.internal.InternalForKotlinNative']
} }
standaloneTest("cleaner_in_main_with_checker") { standaloneTest("cleaner_in_main_with_checker") {
@@ -927,7 +927,7 @@ standaloneTest("cleaner_in_tls_worker") {
enabled = (project.testTarget != 'wasm32') && // Cleaners need workers enabled = (project.testTarget != 'wasm32') && // Cleaners need workers
!isNoopGC !isNoopGC
source = "runtime/basic/cleaner_in_tls_worker.kt" source = "runtime/basic/cleaner_in_tls_worker.kt"
flags = ['-Xopt-in=kotlin.native.internal.InternalForKotlinNative'] flags = ['-opt-in=kotlin.native.internal.InternalForKotlinNative']
} }
standaloneTest("worker_bound_reference0") { standaloneTest("worker_bound_reference0") {
@@ -1406,7 +1406,7 @@ task localClass_localHierarchy(type: KonanLocalTest) {
standaloneTest("objectDeclaration_globalConstants") { standaloneTest("objectDeclaration_globalConstants") {
disabled = (cacheTesting != null) // Cache is not compatible with -opt. disabled = (cacheTesting != null) // Cache is not compatible with -opt.
flags = ["-opt", "-Xopt-in=kotlin.native.internal.InternalForKotlinNative", "-tr"] flags = ["-opt", "-opt-in=kotlin.native.internal.InternalForKotlinNative", "-tr"]
source = "codegen/objectDeclaration/globalConstants.kt" source = "codegen/objectDeclaration/globalConstants.kt"
} }
@@ -1791,7 +1791,7 @@ linkTest("classDelegation_linkTest") {
} }
standaloneTest("contracts") { standaloneTest("contracts") {
flags = [ '-Xopt-in=kotlin.RequiresOptIn', '-tr' ] flags = [ '-opt-in=kotlin.RequiresOptIn', '-tr' ]
source = "codegen/contracts/contracts.kt" source = "codegen/contracts/contracts.kt"
} }
@@ -3182,7 +3182,7 @@ standaloneTest("codegen_escapeAnalysis_stackAllocated") {
disabled = (cacheTesting != null) || // Cache is not compatible with -opt. disabled = (cacheTesting != null) || // Cache is not compatible with -opt.
project.globalTestArgs.contains('-g') || // -g and -opt are incompatible project.globalTestArgs.contains('-g') || // -g and -opt are incompatible
isExperimentalMM // TODO: Experimental MM doesn't support stack-allocated objects yet. isExperimentalMM // TODO: Experimental MM doesn't support stack-allocated objects yet.
flags = ['-opt', '-tr', '-Xopt-in=kotlin.native.internal.InternalForKotlinNative'] flags = ['-opt', '-tr', '-opt-in=kotlin.native.internal.InternalForKotlinNative']
source = "codegen/escapeAnalysis/stackAllocated.kt" source = "codegen/escapeAnalysis/stackAllocated.kt"
} }
@@ -3301,7 +3301,7 @@ standaloneTest("stress_gc_allocations") {
(project.testTarget != "watchos_simulator_arm64") && (project.testTarget != "watchos_simulator_arm64") &&
!isNoopGC !isNoopGC
source = "runtime/memory/stress_gc_allocations.kt" source = "runtime/memory/stress_gc_allocations.kt"
flags = ['-tr', '-Xopt-in=kotlin.native.internal.InternalForKotlinNative'] flags = ['-tr', '-opt-in=kotlin.native.internal.InternalForKotlinNative']
} }
standaloneTest("mpp1") { standaloneTest("mpp1") {
@@ -4852,7 +4852,7 @@ if (PlatformInfo.isAppleTarget(project)) {
enabled = !isNoopGC enabled = !isNoopGC
source = "interop/objc/kt42172/main.kt" source = "interop/objc/kt42172/main.kt"
interop = "objc_kt42172" interop = "objc_kt42172"
flags = ['-Xopt-in=kotlin.native.internal.InternalForKotlinNative'] flags = ['-opt-in=kotlin.native.internal.InternalForKotlinNative']
useGoldenData = true useGoldenData = true
doBeforeBuild { doBeforeBuild {
@@ -4985,7 +4985,7 @@ dynamicTest("interop_cleaners_main_thread") {
cSource = "$projectDir/interop/cleaners/main_thread.cpp" cSource = "$projectDir/interop/cleaners/main_thread.cpp"
clangTool = "clang++" clangTool = "clang++"
useGoldenData = true useGoldenData = true
flags = ['-Xopt-in=kotlin.native.internal.InternalForKotlinNative'] flags = ['-opt-in=kotlin.native.internal.InternalForKotlinNative']
} }
dynamicTest("interop_cleaners_second_thread") { dynamicTest("interop_cleaners_second_thread") {
@@ -4994,7 +4994,7 @@ dynamicTest("interop_cleaners_second_thread") {
cSource = "$projectDir/interop/cleaners/second_thread.cpp" cSource = "$projectDir/interop/cleaners/second_thread.cpp"
clangTool = "clang++" clangTool = "clang++"
useGoldenData = true useGoldenData = true
flags = ['-Xopt-in=kotlin.native.internal.InternalForKotlinNative'] flags = ['-opt-in=kotlin.native.internal.InternalForKotlinNative']
} }
dynamicTest("interop_cleaners_leak") { dynamicTest("interop_cleaners_leak") {
@@ -5003,7 +5003,7 @@ dynamicTest("interop_cleaners_leak") {
cSource = "$projectDir/interop/cleaners/leak.cpp" cSource = "$projectDir/interop/cleaners/leak.cpp"
clangTool = "clang++" clangTool = "clang++"
useGoldenData = true useGoldenData = true
flags = ['-Xopt-in=kotlin.native.internal.InternalForKotlinNative'] flags = ['-opt-in=kotlin.native.internal.InternalForKotlinNative']
} }
dynamicTest("interop_migrating_main_thread_legacy") { dynamicTest("interop_migrating_main_thread_legacy") {
@@ -5598,7 +5598,7 @@ private void configureStdlibTest(KonanGTest task, boolean inWorker) {
enableMultiplatform true enableMultiplatform true
extraOpts inWorker ? '-trw' : '-tr', extraOpts inWorker ? '-trw' : '-tr',
'-Xverify-ir', '-Xverify-ir',
'-Xopt-in=kotlin.RequiresOptIn,kotlin.ExperimentalStdlibApi', '-opt-in=kotlin.RequiresOptIn,kotlin.ExperimentalStdlibApi',
"-friend-modules", project.rootProject.file("${UtilsKt.getKotlinNativeDist(project)}/klib/common/stdlib").absolutePath "-friend-modules", project.rootProject.file("${UtilsKt.getKotlinNativeDist(project)}/klib/common/stdlib").absolutePath
extraOpts project.globalTestArgs extraOpts project.globalTestArgs
} }
@@ -231,7 +231,7 @@ class RunExternalTestGroup extends JavaExec implements CompilerRunner {
def experimentalSettings = findLinesWithPrefixesRemoved(text, "// !USE_EXPERIMENTAL: ") def experimentalSettings = findLinesWithPrefixesRemoved(text, "// !USE_EXPERIMENTAL: ")
if (experimentalSettings.size() != 0) { if (experimentalSettings.size() != 0) {
experimentalSettings.forEach { line -> experimentalSettings.forEach { line ->
line.split(" ").toList().forEach { flags.add("-Xopt-in=$it") } line.split(" ").toList().forEach { flags.add("-opt-in=$it") }
} }
} }
def expectActualLinker = findLinesWithPrefixesRemoved(text, "// EXPECT_ACTUAL_LINKER") def expectActualLinker = findLinesWithPrefixesRemoved(text, "// EXPECT_ACTUAL_LINKER")
@@ -55,7 +55,7 @@ kotlin {
jvm().compilations.all { jvm().compilations.all {
kotlinOptions { kotlinOptions {
freeCompilerArgs = ["-Xopt-in=kotlinx.cli.ExperimentalCli", "-Xopt-in=kotlin.RequiresOptIn"] freeCompilerArgs = ["-opt-in=kotlinx.cli.ExperimentalCli", "-opt-in=kotlin.RequiresOptIn"]
suppressWarnings = true suppressWarnings = true
} }
} }
@@ -94,9 +94,9 @@ targetList.each { target ->
args = [*konanArgs, args = [*konanArgs,
'-output', outputFile, '-output', outputFile,
'-produce', 'library', '-module-name', moduleName, '-produce', 'library', '-module-name', moduleName,
'-Xmulti-platform', '-Xopt-in=kotlinx.cli.ExperimentalCli', '-Xmulti-platform', '-opt-in=kotlinx.cli.ExperimentalCli',
'-Xopt-in=kotlin.ExperimentalMultiplatform', '-opt-in=kotlin.ExperimentalMultiplatform',
'-Werror', '-Xopt-in=kotlin.RequiresOptIn', '-Werror', '-opt-in=kotlin.RequiresOptIn',
commonSrc.absolutePath, commonSrc.absolutePath,
"-Xcommon-sources=${commonSrc.absolutePath}", "-Xcommon-sources=${commonSrc.absolutePath}",
nativeSrc] nativeSrc]
@@ -15,7 +15,7 @@ import kotlin.annotation.AnnotationTarget.*
* *
* Any usage of a declaration annotated with `@ExperimentalCli` must be accepted either by * 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)`, * annotating that usage with the [UseExperimental] annotation, e.g. `@UseExperimental(ExperimentalCli::class)`,
* or by using the compiler argument `-Xopt-in=kotlinx.cli.ExperimentalCli`. * or by using the compiler argument `-opt-in=kotlinx.cli.ExperimentalCli`.
*/ */
@RequiresOptIn("This API is experimental. It may be changed in the future without notice.", RequiresOptIn.Level.WARNING) @RequiresOptIn("This API is experimental. It may be changed in the future without notice.", RequiresOptIn.Level.WARNING)
@Retention(AnnotationRetention.BINARY) @Retention(AnnotationRetention.BINARY)
@@ -12,7 +12,7 @@ import kotlin.native.internal.*
* *
* Any usage of a declaration annotated with `@ExperimentalAssociatedObjects` must be accepted either by * Any usage of a declaration annotated with `@ExperimentalAssociatedObjects` must be accepted either by
* annotating that usage with the [OptIn] annotation, e.g. `@OptIn(ExperimentalAssociatedObjects::class)`, * annotating that usage with the [OptIn] annotation, e.g. `@OptIn(ExperimentalAssociatedObjects::class)`,
* or by using the compiler argument `-Xopt-in=kotlin.reflect.ExperimentalAssociatedObjects`. * or by using the compiler argument `-opt-in=kotlin.reflect.ExperimentalAssociatedObjects`.
*/ */
@RequiresOptIn(level = RequiresOptIn.Level.ERROR) @RequiresOptIn(level = RequiresOptIn.Level.ERROR)
@Retention(value = AnnotationRetention.BINARY) @Retention(value = AnnotationRetention.BINARY)
+2 -2
View File
@@ -17,14 +17,14 @@ configureSourcesJar()
configureJavadocJar() configureJavadocJar()
tasks.withType(org.jetbrains.kotlin.gradle.dsl.KotlinCompile) { tasks.withType(org.jetbrains.kotlin.gradle.dsl.KotlinCompile) {
kotlinOptions.freeCompilerArgs += ["-Xallow-kotlin-package", "-Xopt-in=kotlin.RequiresOptIn"] kotlinOptions.freeCompilerArgs += ["-Xallow-kotlin-package", "-opt-in=kotlin.RequiresOptIn"]
} }
compileKotlinCommon { compileKotlinCommon {
kotlinOptions { kotlinOptions {
freeCompilerArgs += [ freeCompilerArgs += [
"-module-name", project.name, "-module-name", project.name,
"-Xopt-in=kotlin.contracts.ExperimentalContracts", "-opt-in=kotlin.contracts.ExperimentalContracts",
] ]
} }
} }
+2 -2
View File
@@ -16,8 +16,8 @@ dependencies {
compileKotlin2Js { compileKotlin2Js {
kotlinOptions.freeCompilerArgs = [ kotlinOptions.freeCompilerArgs = [
"-Xallow-kotlin-package", "-Xallow-kotlin-package",
"-Xopt-in=kotlin.contracts.ExperimentalContracts", "-opt-in=kotlin.contracts.ExperimentalContracts",
"-Xopt-in=kotlin.RequiresOptIn", "-opt-in=kotlin.RequiresOptIn",
] ]
kotlinOptions { kotlinOptions {
moduleKind = "umd" moduleKind = "umd"
+3 -3
View File
@@ -42,9 +42,9 @@ configureJavadocJar()
compileKotlin { compileKotlin {
kotlinOptions.freeCompilerArgs = [ kotlinOptions.freeCompilerArgs = [
"-Xallow-kotlin-package", "-Xallow-kotlin-package",
"-Xopt-in=kotlin.contracts.ExperimentalContracts", "-opt-in=kotlin.contracts.ExperimentalContracts",
"-Xsuppress-deprecated-jvm-target-warning", "-Xsuppress-deprecated-jvm-target-warning",
"-Xopt-in=kotlin.RequiresOptIn", "-opt-in=kotlin.RequiresOptIn",
] ]
kotlinOptions.moduleName = project.archivesBaseName kotlinOptions.moduleName = project.archivesBaseName
} }
@@ -53,7 +53,7 @@ compileTestKotlin {
kotlinOptions.freeCompilerArgs = [ kotlinOptions.freeCompilerArgs = [
"-Xallow-kotlin-package", "-Xallow-kotlin-package",
"-Xsuppress-deprecated-jvm-target-warning", "-Xsuppress-deprecated-jvm-target-warning",
"-Xopt-in=kotlin.RequiresOptIn", "-opt-in=kotlin.RequiresOptIn",
] ]
} }
+1 -1
View File
@@ -48,7 +48,7 @@ compileKotlin {
"-Xno-optimized-callable-references", "-Xno-optimized-callable-references",
"-Xno-kotlin-nothing-value-exception", "-Xno-kotlin-nothing-value-exception",
"-Xsuppress-deprecated-jvm-target-warning", "-Xsuppress-deprecated-jvm-target-warning",
"-Xopt-in=kotlin.RequiresOptIn", "-opt-in=kotlin.RequiresOptIn",
] ]
moduleName = "kotlin-reflection" moduleName = "kotlin-reflection"
} }
+6 -6
View File
@@ -40,9 +40,9 @@ compileKotlinCommon {
kotlinOptions { kotlinOptions {
freeCompilerArgs = [ freeCompilerArgs = [
"-module-name", project.name, "-module-name", project.name,
"-Xopt-in=kotlin.RequiresOptIn", "-opt-in=kotlin.RequiresOptIn",
"-Xopt-in=kotlin.ExperimentalMultiplatform", "-opt-in=kotlin.ExperimentalMultiplatform",
"-Xopt-in=kotlin.contracts.ExperimentalContracts", "-opt-in=kotlin.contracts.ExperimentalContracts",
"-Xallow-kotlin-package", "-Xallow-kotlin-package",
] ]
} }
@@ -51,9 +51,9 @@ compileKotlinCommon {
compileTestKotlinCommon { compileTestKotlinCommon {
kotlinOptions { kotlinOptions {
freeCompilerArgs += [ freeCompilerArgs += [
"-Xopt-in=kotlin.RequiresOptIn", "-opt-in=kotlin.RequiresOptIn",
"-Xopt-in=kotlin.ExperimentalUnsignedTypes", "-opt-in=kotlin.ExperimentalUnsignedTypes",
"-Xopt-in=kotlin.ExperimentalStdlibApi", "-opt-in=kotlin.ExperimentalStdlibApi",
] ]
} }
} }
@@ -21,7 +21,7 @@ public expect annotation class JsName(val name: String)
* *
* Usages of such annotations will be reported as warnings unless an explicit opt-in with * Usages of such annotations will be reported as warnings unless an explicit opt-in with
* the [OptIn] annotation, e.g. `@OptIn(ExperimentalJsExport::class)`, * the [OptIn] annotation, e.g. `@OptIn(ExperimentalJsExport::class)`,
* or with the `-Xopt-in=kotlin.js.ExperimentalJsExport` compiler option is given. * or with the `-opt-in=kotlin.js.ExperimentalJsExport` compiler option is given.
*/ */
@Suppress("DEPRECATION") @Suppress("DEPRECATION")
@Experimental(level = Experimental.Level.WARNING) @Experimental(level = Experimental.Level.WARNING)
+6 -6
View File
@@ -70,8 +70,8 @@ compileKotlin {
kotlinOptions.freeCompilerArgs = [ kotlinOptions.freeCompilerArgs = [
"-Xallow-kotlin-package", "-Xallow-kotlin-package",
"-Xmultifile-parts-inherit", "-Xmultifile-parts-inherit",
"-Xopt-in=kotlin.RequiresOptIn", "-opt-in=kotlin.RequiresOptIn",
"-Xopt-in=kotlin.contracts.ExperimentalContracts", "-opt-in=kotlin.contracts.ExperimentalContracts",
"-Xsuppress-deprecated-jvm-target-warning", "-Xsuppress-deprecated-jvm-target-warning",
] ]
kotlinOptions.moduleName = project.name kotlinOptions.moduleName = project.name
@@ -81,10 +81,10 @@ compileTestKotlin {
kotlinOptions.freeCompilerArgs = [ kotlinOptions.freeCompilerArgs = [
"-Xallow-kotlin-package", "-Xallow-kotlin-package",
"-Xmulti-platform", "-Xmulti-platform",
"-Xopt-in=kotlin.RequiresOptIn", "-opt-in=kotlin.RequiresOptIn",
"-Xopt-in=kotlin.ExperimentalUnsignedTypes", "-opt-in=kotlin.ExperimentalUnsignedTypes",
"-Xopt-in=kotlin.ExperimentalStdlibApi", "-opt-in=kotlin.ExperimentalStdlibApi",
"-Xopt-in=kotlin.io.path.ExperimentalPathApi", "-opt-in=kotlin.io.path.ExperimentalPathApi",
"-Xcommon-sources=${fileTree('../test').join(',')}", "-Xcommon-sources=${fileTree('../test').join(',')}",
"-Xsuppress-deprecated-jvm-target-warning", "-Xsuppress-deprecated-jvm-target-warning",
] ]
@@ -15,7 +15,7 @@ import kotlin.annotation.AnnotationTarget.*
* *
* Any usage of a declaration annotated with `@ExperimentalPathApi` must be accepted either by * Any usage of a declaration annotated with `@ExperimentalPathApi` must be accepted either by
* annotating that usage with the [OptIn] annotation, e.g. `@OptIn(ExperimentalPathApi::class)`, * annotating that usage with the [OptIn] annotation, e.g. `@OptIn(ExperimentalPathApi::class)`,
* or by using the compiler argument `-Xopt-in=kotlin.io.path.ExperimentalPathApi`. * or by using the compiler argument `-opt-in=kotlin.io.path.ExperimentalPathApi`.
*/ */
@RequiresOptIn(level = RequiresOptIn.Level.ERROR) @RequiresOptIn(level = RequiresOptIn.Level.ERROR)
@Retention(AnnotationRetention.BINARY) @Retention(AnnotationRetention.BINARY)
+4 -4
View File
@@ -67,10 +67,10 @@ compileTestKotlin {
kotlinOptions.freeCompilerArgs = [ kotlinOptions.freeCompilerArgs = [
"-Xallow-kotlin-package", "-Xallow-kotlin-package",
"-Xmulti-platform", "-Xmulti-platform",
"-Xopt-in=kotlin.RequiresOptIn", "-opt-in=kotlin.RequiresOptIn",
"-Xopt-in=kotlin.ExperimentalUnsignedTypes", "-opt-in=kotlin.ExperimentalUnsignedTypes",
"-Xopt-in=kotlin.ExperimentalStdlibApi", "-opt-in=kotlin.ExperimentalStdlibApi",
"-Xopt-in=kotlin.io.path.ExperimentalPathApi", "-opt-in=kotlin.io.path.ExperimentalPathApi",
"-Xcommon-sources=${fileTree('../test').join(',')}", "-Xcommon-sources=${fileTree('../test').join(',')}",
] ]
} }
+6 -6
View File
@@ -138,9 +138,9 @@ compileKotlin2Js {
outputFile = "${buildDir}/classes/main/kotlin.js" outputFile = "${buildDir}/classes/main/kotlin.js"
sourceMap = true sourceMap = true
freeCompilerArgs += [ freeCompilerArgs += [
"-Xopt-in=kotlin.RequiresOptIn", "-opt-in=kotlin.RequiresOptIn",
"-Xopt-in=kotlin.ExperimentalMultiplatform", "-opt-in=kotlin.ExperimentalMultiplatform",
"-Xopt-in=kotlin.contracts.ExperimentalContracts", "-opt-in=kotlin.contracts.ExperimentalContracts",
] ]
} }
} }
@@ -149,9 +149,9 @@ compileTestKotlin2Js {
kotlinOptions { kotlinOptions {
moduleKind = "umd" moduleKind = "umd"
freeCompilerArgs += [ freeCompilerArgs += [
"-Xopt-in=kotlin.RequiresOptIn", "-opt-in=kotlin.RequiresOptIn",
"-Xopt-in=kotlin.ExperimentalUnsignedTypes", "-opt-in=kotlin.ExperimentalUnsignedTypes",
"-Xopt-in=kotlin.ExperimentalStdlibApi", "-opt-in=kotlin.ExperimentalStdlibApi",
] ]
} }
} }
@@ -12,7 +12,7 @@ import findAssociatedObject
* *
* Any usage of a declaration annotated with `@ExperimentalAssociatedObjects` must be accepted either by * Any usage of a declaration annotated with `@ExperimentalAssociatedObjects` must be accepted either by
* annotating that usage with the [OptIn] annotation, e.g. `@OptIn(ExperimentalAssociatedObjects::class)`, * annotating that usage with the [OptIn] annotation, e.g. `@OptIn(ExperimentalAssociatedObjects::class)`,
* or by using the compiler argument `-Xopt-in=kotlin.reflect.ExperimentalAssociatedObjects`. * or by using the compiler argument `-opt-in=kotlin.reflect.ExperimentalAssociatedObjects`.
*/ */
@RequiresOptIn(level = RequiresOptIn.Level.ERROR) @RequiresOptIn(level = RequiresOptIn.Level.ERROR)
@Retention(value = AnnotationRetention.BINARY) @Retention(value = AnnotationRetention.BINARY)
+7 -7
View File
@@ -116,9 +116,9 @@ compileKotlin {
freeCompilerArgs = [ freeCompilerArgs = [
"-Xallow-kotlin-package", "-Xallow-kotlin-package",
"-Xmultifile-parts-inherit", "-Xmultifile-parts-inherit",
"-Xopt-in=kotlin.RequiresOptIn", "-opt-in=kotlin.RequiresOptIn",
"-Xopt-in=kotlin.ExperimentalMultiplatform", "-opt-in=kotlin.ExperimentalMultiplatform",
"-Xopt-in=kotlin.contracts.ExperimentalContracts", "-opt-in=kotlin.contracts.ExperimentalContracts",
"-Xuse-14-inline-classes-mangling-scheme", "-Xuse-14-inline-classes-mangling-scheme",
"-Xsuppress-deprecated-jvm-target-warning", "-Xsuppress-deprecated-jvm-target-warning",
] ]
@@ -129,9 +129,9 @@ compileKotlin {
compileTestKotlin { compileTestKotlin {
kotlinOptions { kotlinOptions {
freeCompilerArgs += [ freeCompilerArgs += [
"-Xopt-in=kotlin.RequiresOptIn", "-opt-in=kotlin.RequiresOptIn",
"-Xopt-in=kotlin.ExperimentalUnsignedTypes", "-opt-in=kotlin.ExperimentalUnsignedTypes",
"-Xopt-in=kotlin.ExperimentalStdlibApi", "-opt-in=kotlin.ExperimentalStdlibApi",
"-Xsuppress-deprecated-jvm-target-warning", "-Xsuppress-deprecated-jvm-target-warning",
] ]
// This is needed for JavaTypeTest; typeOf for non-reified type parameters doesn't work otherwise, for implementation reasons. // This is needed for JavaTypeTest; typeOf for non-reified type parameters doesn't work otherwise, for implementation reasons.
@@ -140,7 +140,7 @@ compileTestKotlin {
} }
compileLongRunningTestKotlin { compileLongRunningTestKotlin {
kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.ExperimentalStdlibApi" kotlinOptions.freeCompilerArgs += "-opt-in=kotlin.ExperimentalStdlibApi"
} }
task longRunningTest(type: Test, dependsOn: longRunningTestClasses) { task longRunningTest(type: Test, dependsOn: longRunningTestClasses) {
+3 -3
View File
@@ -12,9 +12,9 @@ sourceSets {
compileTestKotlin { compileTestKotlin {
kotlinOptions { kotlinOptions {
freeCompilerArgs = [ freeCompilerArgs = [
"-Xopt-in=kotlin.ExperimentalStdlibApi", "-opt-in=kotlin.ExperimentalStdlibApi",
"-Xopt-in=kotlin.ExperimentalUnsignedTypes", "-opt-in=kotlin.ExperimentalUnsignedTypes",
"-Xopt-in=kotlin.time.ExperimentalTime", "-opt-in=kotlin.time.ExperimentalTime",
] ]
} }
} }
@@ -12,7 +12,7 @@ import kotlin.annotation.AnnotationTarget.*
* *
* Any usage of a declaration annotated with `@ExperimentalStdlibApi` must be accepted either by * Any usage of a declaration annotated with `@ExperimentalStdlibApi` must be accepted either by
* annotating that usage with the [OptIn] annotation, e.g. `@OptIn(ExperimentalStdlibApi::class)`, * annotating that usage with the [OptIn] annotation, e.g. `@OptIn(ExperimentalStdlibApi::class)`,
* or by using the compiler argument `-Xopt-in=kotlin.ExperimentalStdlibApi`. * or by using the compiler argument `-opt-in=kotlin.ExperimentalStdlibApi`.
*/ */
@Suppress("DEPRECATION") @Suppress("DEPRECATION")
@Experimental(level = Experimental.Level.ERROR) @Experimental(level = Experimental.Level.ERROR)
@@ -14,7 +14,7 @@ import kotlin.internal.RequireKotlinVersionKind
* *
* Any usage of a declaration annotated with `@ExperimentalMultiplatform` must be accepted either by * Any usage of a declaration annotated with `@ExperimentalMultiplatform` must be accepted either by
* annotating that usage with the [OptIn] annotation, e.g. `@OptIn(ExperimentalMultiplatform::class)`, * annotating that usage with the [OptIn] annotation, e.g. `@OptIn(ExperimentalMultiplatform::class)`,
* or by using the compiler argument `-Xopt-in=kotlin.ExperimentalMultiplatform`. * or by using the compiler argument `-opt-in=kotlin.ExperimentalMultiplatform`.
*/ */
@Suppress("DEPRECATION") @Suppress("DEPRECATION")
@Experimental @Experimental
@@ -18,7 +18,7 @@ import kotlin.reflect.KClass
* Call sites of any declaration annotated with that marker should opt in to the API either by using [OptIn], * Call sites of any declaration annotated with that marker should opt in to the API either by using [OptIn],
* or by being annotated with that marker themselves, effectively causing further propagation of the opt-in requirement. * or by being annotated with that marker themselves, effectively causing further propagation of the opt-in requirement.
* *
* This class requires opt-in itself and can only be used with the compiler argument `-Xopt-in=kotlin.RequiresOptIn`. * This class requires opt-in itself and can only be used with the compiler argument `-opt-in=kotlin.RequiresOptIn`.
* *
* @property message message to be reported on usages of API without an explicit opt-in, or empty string for the default message. * @property message message to be reported on usages of API without an explicit opt-in, or empty string for the default message.
* The default message is: "This declaration is experimental and its usage should be marked with 'Marker' * The default message is: "This declaration is experimental and its usage should be marked with 'Marker'
@@ -50,7 +50,7 @@ public annotation class RequiresOptIn(
* Allows to use the API denoted by the given markers in the annotated file, declaration, or expression. * Allows to use the API denoted by the given markers in the annotated file, declaration, or expression.
* If a declaration is annotated with [OptIn], its usages are **not** required to opt in to that API. * If a declaration is annotated with [OptIn], its usages are **not** required to opt in to that API.
* *
* This class requires opt-in itself and can only be used with the compiler argument `-Xopt-in=kotlin.RequiresOptIn`. * This class requires opt-in itself and can only be used with the compiler argument `-opt-in=kotlin.RequiresOptIn`.
*/ */
@Target( @Target(
CLASS, PROPERTY, LOCAL_VARIABLE, VALUE_PARAMETER, CONSTRUCTOR, FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER, EXPRESSION, FILE, TYPEALIAS CLASS, PROPERTY, LOCAL_VARIABLE, VALUE_PARAMETER, CONSTRUCTOR, FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER, EXPRESSION, FILE, TYPEALIAS
@@ -14,7 +14,7 @@ import kotlin.internal.InlineOnly
* *
* Any usage of a declaration annotated with `@ExperimentalContracts` must be accepted either by * Any usage of a declaration annotated with `@ExperimentalContracts` must be accepted either by
* annotating that usage with the [OptIn] annotation, e.g. `@OptIn(ExperimentalContracts::class)`, * annotating that usage with the [OptIn] annotation, e.g. `@OptIn(ExperimentalContracts::class)`,
* or by using the compiler argument `-Xopt-in=kotlin.contracts.ExperimentalContracts`. * or by using the compiler argument `-opt-in=kotlin.contracts.ExperimentalContracts`.
*/ */
@Suppress("DEPRECATION") @Suppress("DEPRECATION")
@Retention(AnnotationRetention.BINARY) @Retention(AnnotationRetention.BINARY)
@@ -10,7 +10,7 @@ package kotlin.experimental
* *
* Any usage of a declaration annotated with `@ExperimentalTypeInference` must be accepted either by * Any usage of a declaration annotated with `@ExperimentalTypeInference` must be accepted either by
* annotating that usage with the [OptIn] annotation, e.g. `@OptIn(ExperimentalTypeInference::class)`, * annotating that usage with the [OptIn] annotation, e.g. `@OptIn(ExperimentalTypeInference::class)`,
* or by using the compiler argument `-Xopt-in=kotlin.experimental.ExperimentalTypeInference`. * or by using the compiler argument `-opt-in=kotlin.experimental.ExperimentalTypeInference`.
*/ */
@Suppress("DEPRECATION") @Suppress("DEPRECATION")
@Experimental(level = Experimental.Level.ERROR) @Experimental(level = Experimental.Level.ERROR)
@@ -16,7 +16,7 @@ import kotlin.annotation.AnnotationTarget.*
* *
* Any usage of a declaration annotated with `@ExperimentalTime` must be accepted either by * Any usage of a declaration annotated with `@ExperimentalTime` must be accepted either by
* annotating that usage with the [OptIn] annotation, e.g. `@OptIn(ExperimentalTime::class)`, * annotating that usage with the [OptIn] annotation, e.g. `@OptIn(ExperimentalTime::class)`,
* or by using the compiler argument `-Xopt-in=kotlin.time.ExperimentalTime`. * or by using the compiler argument `-opt-in=kotlin.time.ExperimentalTime`.
*/ */
@Suppress("DEPRECATION") @Suppress("DEPRECATION")
@Experimental(level = Experimental.Level.ERROR) @Experimental(level = Experimental.Level.ERROR)
@@ -15,7 +15,7 @@ import kotlin.internal.RequireKotlinVersionKind
* *
* Usages of such API will be reported as warnings unless an explicit opt-in with * Usages of such API will be reported as warnings unless an explicit opt-in with
* the [OptIn] annotation, e.g. `@OptIn(ExperimentalUnsignedTypes::class)`, * the [OptIn] annotation, e.g. `@OptIn(ExperimentalUnsignedTypes::class)`,
* or with the `-Xopt-in=kotlin.ExperimentalUnsignedTypes` compiler option is given. * or with the `-opt-in=kotlin.ExperimentalUnsignedTypes` compiler option is given.
* *
* It's recommended to propagate the experimental status to the API that depends on unsigned types by annotating it with this annotation. * It's recommended to propagate the experimental status to the API that depends on unsigned types by annotating it with this annotation.
*/ */
@@ -76,7 +76,7 @@
<jvmTarget>1.8</jvmTarget> <jvmTarget>1.8</jvmTarget>
<args> <args>
<arg>-Xjvm-default=enable</arg> <arg>-Xjvm-default=enable</arg>
<arg>-Xopt-in=org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI</arg> <arg>-opt-in=org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI</arg>
</args> </args>
</configuration> </configuration>
</plugin> </plugin>