How to find usages method of the actual implementation, not interface

Answered

I have same issue as: https://stackoverflow.com/q/58290379/5419748 

public interface Dog {
    void bark(int volume);
}
public class Lab implements Dog {
    public void bark(int volume) {
        System.out.println("woof");
    }
}
public class Collie implements Dog {
    public void bark(int volume) {
        System.out.println("woof");
    }
}
public class Main {

    public static void main(String[] args) {
        Dog onyx = new Lab();
        Dog lassie = new Collie();

        onyx.bark(50);
        lassie.bark(20);
    }
}

When find usages at method bark in class Dog,
Actual: it shows 2 lines onyx.bark(50);, lassie.bark(20);

Expected: show only onyx.bark(50);

Does Intellij support that at the moment? Any plan for that? Is it doable?
Btw this one https://www.jetbrains.com/help/idea/find-usages-method-options.html (Ctrl+Alt+Shift+F7) doesn't help since we declare Dog onyx = new Lab(); not Lab onyx = new Lab();

Thanks

1
4 comments

Seems to be caused by https://youtrack.jetbrains.com/issue/IDEA-207332

Feel free to comment inside. 

1

No, it's related but I think his issue is that the new version has incorrect default find usages (seach all usages of super class) compare to the old version (can search usages of current class). The issue I have now is that the find usages doesn't support to find usages for actual implementation, see the code above.

0

I also reported this one at here, info so far not support yet: https://intellij-support.jetbrains.com/hc/en-us/requests/3377420

0

We will double-check if there is a way to implement that in scope of https://youtrack.jetbrains.com/issue/IDEA-273138. PLease vote and follow. 

However, Lejia is right, there are a lot of consequences that should be analyzed.

0

Please sign in to leave a comment.