Anyone else running into an issue with `-Xopt-in` ...
# gradle
e
Anyone else running into an issue with
-Xopt-in
and Kotlin 1.6.20-RC while using Gradle Kotlin DSL? https://youtrack.jetbrains.com/issue/KT-51708
a
Use
-opt-in=kotlin.RequiresOptIn
. The
-opt-in kotlin.RequiresOptIn
syntax is only valid in CLI (i.e. when you invoke kotlin compiler on the command line).
e
presumably
listOf("-opt-in", "kotlin.RequiresOptIn")
would work like the CLI too. but a single argument with a space in it is definitely not right
also, the Gradle field is in
languageSettings
e.g.
Copy code
kotlin.sourceSets.all {
    languageSettings.optIn(...)
}
1
e
Use
-opt-in=kotlin.RequiresOptIn
If I use
-opt-in=Kotlin.RequiresOptIn
I get an error that says:
Copy code
e: Invalid argument: -opt-in=kotlin.RequiresOptIn
listOf("-opt-in", "kotlin.RequiresOptIn")
Results in an error that says:
Copy code
e: Invalid argument: -opt-in
The Gradle field is in
languageSettings
That was it, thanks! I thought it was in
kotlinOptions
because of https://youtrack.jetbrains.com/issue/KT-47099
e
so the change isn't in -RC, then. https://github.com/JetBrains/kotlin/commit/d8417fd622749bdcef028e1d7f75d992725b0765 should be in -RC2 though
e
Whoops I left that out in OP. I am using RC2. It looks like the issue might be that Gradle Kotlin DSL forces Kotlin 1.5.31