I use features that require `ExperimentalStdlibApi...
# intellij
k
I use features that require
ExperimentalStdlibApi
, and I add it via Gradle plugin that adds
-Xopt-in=kotlin.ExperimentalStdlibApi
to
kotlinOptions.freeCompilerArgs
. Building with Gradle from the command line shows no errors, but Intellij keeps underlining functions (like
buildList
) and saying that I need to add the annotation. Using the latest Kotlin 1.6 preview plugin. Any ideas what to try to fix it?
It doesn't even underline those buildLists as errors until I open the file... not even after building the project. Weird...
Interesting, now Intellij no longer understands
JvmInline
annotations...
Switched to Gradle Kotlin plugin 1.6 ... now buildList is just unresolved reference 😄 from bad to worse, it seems 😄
It seems everything I do inside the Gradle buildSrc plugin (enable experimental apis, add serialization, etc...) Intellij fails to understand, now basically nothing works
And now I'm basically using Intellij as a slow Notepad 🤣
a
https://kotlinlang.org/docs/mpp-dsl-reference.html#language-settings what happens if you use
languageSettings
? Maybe the IDE has better support for the gradle DSL instead of compiler args? I think docs are outdated though: the
useExperimentalAnnotation
method is deprecated and replaced with
optIn
j
idea EAP? it's a bug.
k
@ankushg thanks for the suggestion, here is the complete configuration block (I'm not using multiplatform):
Copy code
tasks {
    compileKotlin {
        kotlinOptions.languageVersion = "1.5"
        kotlinOptions.apiVersion = "1.5"
        kotlinOptions.jvmTarget = "16"
        kotlinOptions.freeCompilerArgs = listOf(
            "-Xopt-in=kotlin.ExperimentalStdlibApi",
            "-Xopt-in=kotlin.time.ExperimentalTime",
            "-Xopt-in=kotlin.contracts.ExperimentalContracts",
        )
    }
}
It's not EAP, I'm using 2021.2.3 ... I'll try to reproduce it later on a minimal example