k2 gives different warnings for using deprecated c...
# k2-adopters
r
k2 gives different warnings for using deprecated code, can I for a specific file suppress deprecation warnings with @File (specifically, an enum class annotated with @Deprecated)
d
Can you please share example of code?
r
Copy code
fun main() {
    println(Foo.Grid)
}

@Deprecated("Use Bar enum instead. Don't add new values to this deprecated enum.")
enum class Foo {
    Default,
    Upcoming,
    Grid
}
it was easy....
Copy code
@file:Suppress("DEPRECATION")
or
Copy code
@Suppress("DEPRECATION")
these types of warnings are correct in k2 but it is new that they are promoted to the compiler warnings list in the gradle output
d
I can't reproduce it
Copy code
@file:Suppress("DEPRECATION")

fun main() {
    println(Foo.Grid)
}

@Deprecated("Use Bar enum instead. Don't add new values to this deprecated enum.")
enum class Foo {
    Default,
    Upcoming,
    Grid
}
Copy code
// Build output:
> Task :compileKotlin
w: ATTENTION!
 This build uses experimental K2 compiler: 
  -Xuse-k2

> Task :compileJava NO-SOURCE
Same for
Copy code
fun main() {
    @Suppress("DEPRECATION")
    println(Foo.Grid)
}
r
sorry I was unclear, only without the supression I get a warning. But I did not notice these warnings before k2. All is good, I will add supression at some places
k2 is behaving correctly