Kotlin

Kotlin

Made by DeepSource

Unnecessary abstract modifier in interface detected KT-W1054

Anti-pattern
Minor
Autofix

In Kotlin, the abstract keyword is redundant when declaring interfaces and their members. Interfaces are implicitly abstract in Kotlin, so there is no need to use the abstract keyword, and the same is true for any members of an interface. Omitting the abstract keyword does not affect the behavior or functionality of an interface, and allows for more concise code.

Bad Practice

abstract interface Foo { // abstract keyword not needed
    abstract fun x() // abstract keyword not needed
    abstract var y: Int // abstract keyword not needed
}

Recommended

Remove the abstract modifier, since it's redundant.

interface Foo {
    fun x()
    var y: Int
}