Call Hierarchy doesn't show overloaded methods

Answered

This seems similar to an issue I posted a while back, but not exactly the same.
(https://intellij-support.jetbrains.com/hc/en-us/community/posts/5968113688210-Call-Hierarchy-doesn-t-work-on-implementing-methods?input_string=Call%20Hierarchy%20doesn%27t%20show%20overloaded%20methods)

Whether in the interface or in the implementing class, the Call Hierarchy no longer shows overloaded methods. It only shows calls for the single selected signature. I'm pretty sure this used to work. Is there a setting for Call Hierarchy separate from Find Usages that I'm missing?

Find/Show Usages still shows overloaded methods.

 

IntelliJ IDEA 2022.3.3 (Ultimate Edition)
Build #IU-223.8836.41, built on March 9, 2023
Runtime version: 17.0.6+1-b653.34 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 11 10.0
Non-Bundled Plugins:
    cc.ssnoodles.db2j-plugin-ce (1.0.5)
    com.jetbrains.ChooseRuntime (1.2)
    com.euphoricity.gitignore (0.3)
    GenerateSerialVersionUID (3.0.3)
    Builder Generator (1.3.0)
    String Manipulation (9.7.1)
    com.intellij.spring.webflow (223.8836.41)
    MavenRunHelper (4.23.222.2964.0)
    de.u-mass.idea.copyConstructor (1.2)
    pro.bashsupport (3.2.1.223)
    org.exbin.deltahex.intellij (0.2.7)
    com.haulmont.jpab (2023.1.2-223)

Kotlin: 223-1.8.0-release-345-IJ8836.41

0
6 comments

Hello,

Could you please provide code example? If I call method and overloaded method in some other method - both are shown in hierarchy.

1

Okay, I'll try to reproduce it in a small sample project when I get a chance. I'll also poke around my existing project and other projects to see if I can find cases where it does work for me, and if there's any discernible pattern.

 

0

Thanks! I'll be waiting.

0

I tried a couple other cases in my real project, and still did not get call hierarchy for overloaded signatures.

Here's a tiny project that reproduces the result.

Placing my cursor in the method name in the declaration of either foo() or foo(int) in interface X and selecting Navigate | Call Hierarchy, I expect to see call stacks for both signatures, but I only see it for the selected one.

X.java

package jeff.test;

public interface X {
int foo();

int foo(int i);
}



C.java

public class C implements X {
@Override
public int foo() {
return 0;
}

@Override
public int foo(int i) {
return i;
}
}



Main.java

package jeff.test;

public class Main {
public static void main(String[] args) {
X x = new C();

int i1 = x.foo();
int i2 = x.foo(123);

Other other = new Other();
other.bar();
other.baz();
}
}


Other.java

package jeff.test;

public class Other {

public void bar() {
X x = new C();

int i1 = x.foo();
}

public void baz() {
X x = new C();

int i2 = x.foo(123);
}
}


Thanks!

Jeff

 

0

Jeff,

Thanks for the example! Currently it's not possible. Feel free to create feature request on YouTrack: https://youtrack.jetbrains.com/issues/IDEA

1

Interesting. I could have sworn that worked at one point.

Thanks for looking into it!

0

Please sign in to leave a comment.