https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
d

Daniele B

11/06/2023, 9:28 AM
Can anyone show me how I can mute the "The expect/actual classes are in Beta" warning? I am supposed to use an opt-in compiler key:
-Xexpect-actual-classes
Where should compiler keys be placed, and what is the syntax? https://youtrack.jetbrains.com/issue/KT-61573
d

Daniele B

11/06/2023, 9:37 AM
I added it to the end of the shared module's gradle file:
Copy code
tasks.named("compileKotlin", org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask::class.java) {
    compilerOptions {
        freeCompilerArgs.add("-Xexpect-actual-classes")
    }
}
and I got this error:
Copy code
Task with name 'compileKotlin' not found in project ':shared'.

* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Exception is:
org.gradle.api.UnknownTaskException: Task with name 'compileKotlin' not found in project ':shared'.
	at org.gradle.api.internal.tasks.DefaultTaskCollection.createNotFoundException(DefaultTaskCollection.java:102)
	at org.gradle.api.internal.tasks.DefaultTaskCollection.createNotFoundException(DefaultTaskCollection.java:46)
	at org.gradle.api.internal.DefaultNamedDomainObjectCollection.named(DefaultNamedDomainObjectCollection.java:360)
	at org.gradle.api.internal.tasks.DefaultTaskCollection.named(DefaultTaskCollection.java:112)
	at org.gradle.api.internal.tasks.DefaultTaskCollection.named(DefaultTaskCollection.java:46)
z

zsmb

11/06/2023, 9:51 AM
Can you see if this works instead?
Copy code
tasks.withType<KotlinCompile>().configureEach {
    kotlinOptions {
        freeCompilerArgs += "-Xexpect-actual-classes"
    }
}
d

Daniele B

11/06/2023, 9:56 AM
thanks! it works
8 Views