Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

How to suppress deprecations in for KotlinCompile in Gradle similar to JavaCompile?

JavaCompile(works):

tasks.withType(JavaCompile) {
    configure(options) {
        compilerArgs << '-Xlint:-deprecation'
    }
}

KotlinCompile(does not work):

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
    kotlinOptions {
        freeCompilerArgs = ["-Xjavac-arguments=-Xlint:-deprecation"]
    }
}

References:

Similar questions:

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
358 views
Welcome To Ask or Share your Answers For Others

1 Answer

Currently Kotlin does not support Surpressing compiler warnings. They do have some categories to surpress. But different then that the only way none is:

@Suppress("DEPRECATION")

Sometimes Surpress will not work by just inputing the annotation which should work on runtime. You might need to add something like the following

val foo = error.asDynamic().response
if (foo is AxiosResponse<String>) {
    @Suppress("UNCHECKED_CAST")
    val response = foo as AxiosResponse<String>
}

Which is not your case. But apparently other people have had the similar issue. I suggest taking a brief look at reddit. Which also not the case above but can lead you.

https://www.reddit.com/r/Kotlin/comments/bsgk5w/what_do_i_have_to_do_to_suppress_my_unchecked/


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...