Search code examples
kotlinintellij-idea

How to find where a Kotlin interface method is overridden in intellij?


Given this Foo interface

interface Foo {
    fun whereIsThisImplemented(a: String): String
}

// How do I use the above interface to find the below implementation
class Bar: Foo {
    override fun whereIsThisImplemented(a: String): String {
        return a
    }

}

is there a simple way of finding where the whereIsThisImplemented method is overridden through intellij?

While whereIsThisImplemented is highlighted, Using edit -> Find Usages -> Find Usage Settings, none of the options will find the Override fun whereIsThisImplemented.

I could find all places the interface is implemented, then look for the method, but this is extremely cumbersome and I was hoping there was a simpler way that I was missing.


Solution

  • Menu: Navigate -> Implementations . Note down the shortcut besides the menu.

    Alternatively, you can click on the down arrow on the left of the method declaration

    enter image description here

    Tip: Install key promoter plugin so that you get a notification of keyboard shortcut everytime you use the mouse.