kotlin:S6517 should ignore interfaces with default values in abstract method signature

What language is this for?
kotlin

Which rule?
S6517

Why do you believe it’s a false-positive/false-negative?
In Kotlin, a functional interface cannot have default values defined in abstract method signature. The following example would not compile if fun prefix was added to the interface declaration.

interface Foo {
    fun bar(baz: Int = 0)
}

This is similar issue to the one reported here: kotlin:S6517 should ignore interface which contains generic method. The difference is that this time it is not generics, but default values preventing making Kotlin interface functional.

Versions

  • SonarQube for IDE (10.23.0.81344)
  • IntelliJ IDEA 2025.1.1.1
  • Kotlin 2.1.21

Hello @tadjan,

Welcome to the community!

Thanks for reporting this issue. This is indeed a False-positive. I recorded it and we’ll handle it with the next release.

Best,
Margarita

1 Like