I have this code in my build.gradle.kts and it sho...
# compose-desktop
z
I have this code in my build.gradle.kts and it shows a warning to add the opt in option to the compiler options but it's not working
Copy code
@OptIn(ExperimentalComposeLibrary::class)
implementation(compose.material3)
Copy code
tasks.withType<KotlinCompile>().configureEach {
    kotlinOptions {
        freeCompilerArgs = freeCompilerArgs + "-opt-in=kotlin.RequiresOptIn"
    }
}
j
Note: Opt-in is stable as of Kotlin 1.7 so you never have to opt-in to
RequiresOptIn
. You can delete that build snippet with no effective change to what's happening (assuming you're on Kotlin 1.7+).
z
It says
This annotation should be used with the compiler argument '-opt-in=kotlin.RequiresOptIn'
on the OptIn annotation for material3
j
Well they probably thought they would ship a year ago. You do not need it: https://kotlinlang.org/docs/whatsnew17.html#stable-opt-in-requirements
g
This task sets the flag to Kotlin compiler which is used to build your project, but warning is about Kotlin used by Gradle, not sure that you can set additional compiler flags, but I may be wrong, anyway you cannot configure it this way I would just ignore it for now, the warning should go away with Gradle 7.6 (it should use Kotlin 1.7k
z
Alright thanks