Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

ide - IntelliJ Call Hierarchy with multiple inheritance

The Call Hierarchy of IntelliJ is great, it shows all the places where a method is called. Consider the following classes:

interface Parent {
    void callMe();
}
class ChildOne implements Parent {
    @Override
    public void callMe() {}
}
class ChildTwo implements Parent {
    @Override
    public void callMe() {}
}
class Run1 {
    void callee1() {
        Parent childOne = new ChildOne();
        childOne.callMe();
    }
}

If you open Call Hierarchy on ChildOne#callMe() it will show Run1#callee1, but this is also true if you select in ChildTwo#callMe, because in Run1#callee1 we created a type of Parent and then assigned a ChildOne reference, so it makes sense that IntelliJ shows on both ChildOne and Two.

Now, is there a way to make IntelliJ a bit more 'smart' and consider just the exactly runtime evaluated caller? If selected from ChildTwo it shouldn't return any result, as in runtime it wouldn't be called.

I'm not sure if this would be easily feasible or not, any thoughts are appreciated.

question from:https://stackoverflow.com/questions/65935377/intellij-call-hierarchy-with-multiple-inheritance

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...