How to suppress specific Kotlinc/Javac compiler warnings?

后端 未结 1 1125
温柔的废话
温柔的废话 2020-12-15 15:51

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

JavaCompile(works):

相关标签:
1条回答
  • 2020-12-15 16:46

    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/

    0 讨论(0)
提交回复
热议问题