With the @Suppress
annotation You can suppress any diagnostics on any declaration or expression.
Examples:
Suppress warning on parameter:
fun foo(a: Int, @Suppress("UNUSED_PARAMETER") b: Int) = a
Suppress all UNUSED_PARAMETER warnings inside declaration
@Suppress("UNUSED_PARAMETER")
fun foo(a: Int, b: Int) {
fun bar(c: Int) {}
}
@Suppress("UNUSED_PARAMETER")
class Baz {
fun foo(a: Int, b: Int) {
fun bar(c: Int) {}
}
}
Additionally IDEA's intentions(Alt+Enter) can help you to suppress any diagnostics:
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…