KT.OPTIONAL_ABSTRACT_KEYWORD

Unnecessary abstract modifier

This rule reports abstract modifiers which are unnecessary and can be removed.

Noncompliant Code

Copy
abstract interface Foo { // abstract keyword not needed

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

Compliant Code

Copy
interface Foo {

    fun x()
    var y: Int
}

The content on this page is adapted from the Detekt Docs. Copyright ©2022 The Detekt Team. All rights reserved. https://detekt.dev/comments.html