Skip to content

Document how to disable warning for ExperimentalCoroutineApi and ObsoleteCoroutineApi #859

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jcornaz opened this issue Nov 25, 2018 · 8 comments
Assignees
Labels
docs KDoc and API reference

Comments

@jcornaz
Copy link
Contributor

jcornaz commented Nov 25, 2018

Prior Kotlin 1.3 documentation was clear on how to disable warning for experimental usage of coroutines. (for gradle: kotlin.experimental.coroutines 'enable'). And it worked well.

But since Kotlin 1.3, I'm not able to find clear and official documentation about how to disable warnings for usages of ExperimentalCoroutineApi and ObsoleteCoroutineApi. I managed to find few things but it is never clear, and doesn't work well.

I suggest to document this. Here is few places I'd expect to find that information:

@qwwdfsad
Copy link
Collaborator

Are you using Intellij IDEA? It should provide a clear advice what you can do with a quickfix

@jcornaz
Copy link
Contributor Author

jcornaz commented Nov 26, 2018

Yes I use IntelliJ IDEA, but it only propose to add the UseExperimental annotation or the used annotation to the member. It doesn't help me to understand how to disable warnings in the whole project.

By the way, I did find what to do. (using freeCompilerArgs for gradle, and plugin configuration arguments for maven)

But I think it should be easier and quicker to find that information and it deserve proper documentation.

@matejdro
Copy link

Yeah, situation is not ideal. Intellij suggests to add UseExperimental annotation. But this annotation itself is ALSO experimental. So to use this annotation, I had to add this to the gradle file, which was not documented at all:

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
            kotlinOptions.freeCompilerArgs += ["-Xuse-experimental=kotlin.Experimental"]
        }

@jcornaz
Copy link
Contributor Author

jcornaz commented Dec 15, 2018

@qwwdfsad, any update on this?

@qwwdfsad qwwdfsad self-assigned this Dec 18, 2018
@qwwdfsad qwwdfsad added the docs KDoc and API reference label Dec 18, 2018
@qwwdfsad
Copy link
Collaborator

@jcornaz we've found a huge documentation backlog in Kotlin triggered by your issue (https://youtrack.jetbrains.com/issue/KT-28589, parent and related), but it won't be fixed soon.
So I will document it in coroutines separately

@jcornaz
Copy link
Contributor Author

jcornaz commented Dec 18, 2018

Ok, thanks @qwwdfsad.

@theapache64
Copy link

I use

 kotlinOptions {
        // Disabling coroutine's ExperimentalCoroutinesApi warning
        freeCompilerArgs += [
                "-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi",
                "-Xuse-experimental=kotlinx.coroutines.TheAnnotationYouWantToDisable"
        ]
    }

@i30mb1
Copy link

i30mb1 commented Aug 26, 2022

I use

tasks.withType<KotlinCompile>().configureEach {
    kotlinOptions {
        freeCompilerArgs = freeCompilerArgs + listOf("-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi")
        jvmTarget = "11"
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs KDoc and API reference
Projects
None yet
Development

No branches or pull requests

5 participants