Navigate between multiple usages of a method in call hierarchy
Hi,
is it somehow possible to navigate between multiple method calls in the call hierarchy if these calls occur within one other method?
Example call hierarchy from JDK code:
PKIXValidator.doValidate(X509Certificate[], PKIXBuilderParameters) (sun.security.validator)
PKIXValidator.engineValidate(X509Certificate[], Collection<X509Certificate>, List<byte[]>, AlgorithmConstraints, Object)(3 usages) (sun.security.validator)
Validator.validate(X509Certificate[], Collection<X509Certificate>, List<byte[]>, AlgorithmConstraints, Object) (sun.security.validator)
Validator.validate(X509Certificate[], Collection<X509Certificate>, Object) (sun.security.validator)
X509TrustManagerImpl.validate(Validator, X509Certificate[], List<byte[]>, AlgorithmConstraints, String) (sun.security.ssl)
As you can see, IntelliJ states "(3 usages)" of PKIXValidator.doValidate inside PKIXValidator.engineValidate but I haven't found a way to navigate between those usages. There are no toolbar buttons for this and there is no context menu for entries in the Hierarchy view. Also, no hotkey or menu item on the main menu helps.
Any suggestions?
Please sign in to leave a comment.
Hello,
Please clarify what OS are you using? Do you want to just "walk" through the usages? If yes, please tell if Alt+Cmd+arrow up and down works for you?
Thanks
I'm using Windows 10 over RDP, so Ctrl+Alt+{Arrow} hot keys don't work because Microsoft RDP Clients use such key combinations for their own purposes. I already had to remap "Navigate" | "Back" and "Navigate" | "Forward" to other hot keys.
The Ctrl+Alt+Up and Ctr+Alt+Down hot keys you mentioned are "Navigate" | "Go to previous call" and "Navigate" | "Go to next call". When I click those menu entries while having the focus on the "Hierarchy" view, IntelliJ simply navigates up and down in the hierarchy list and this is NOT what I meant.
You can have multiple call sites of a method inside one single other method, like in my JDK example: There are three calls of PKIXValidator.doValidate inside of PKIXValidator.engineValidate and I cannot find a way to jump to each of those call sites directly from the "Hierarchy" view. A double click on PKIXValidator.engineValidate in this view jumps only to the first occurrence, i.e., the first call site of PKIXValidator.doValidate inside of PKIXValidator.engineValidate.
In Eclipse you have a side pane inside a Call Hierarchy view that, if applicable, provides a list of multiple call sites inside one method and you can click on each of those elements in the list and directly jump to each of those call sites.
I hope this better illustrates what I' m after.
Afr,
Thank you for the clarification! Seems that there is already created report for the issue that you are describing, please follow it:
https://youtrack.jetbrains.com/issue/IDEA-228767
Hi Olga,
this issue you mentioned is not exactly about the same problem I have with IntelliJ.
Example code for my case looks like this:
public class TestClass {
void top() {}
void caller1() {
top();
top();
}
void caller2() {
top();
}
void subCaller() {
caller1();
}
}
As you can see, the method caller1() contains two call sites for the method top().
The resulting call hierarchy in IntelliJ IDEA 2020.2.1 looks like this (alphabetical sorting is active):
I want to navigate to each of those "2 usages", but unfortunately, there aren't even separate nodes for those two distinct call sites in the hierarchy.
Regards,
Alex
Hi Alex,
Thanks for clarification. I have created an issue at YouTrack covering this case, please follow:
https://youtrack.jetbrains.com/issue/IDEA-249233