How can I search for all method calls to a specified interface or class?

Right now, I need to find all references to the interface or class, and then find all references to those, to see the method calls.
Can it be done in one command like using Structural Search?

2 comments
Comment actions Permalink

There is "Call Hierarchy" action (on the main menu "Navigate | Call Hierarchy") for method calls.
https://www.jetbrains.com/idea/help/building-call-hierarchy.html

0
Comment actions Permalink

An answer using Structural Search (or as I like to call it "Find Usages on Steroids").
To find all calls to methods of a specific class in Java code you can use a query like the following:

$a$.$method$($arg$)


with the variable defined as follows:

$a$

minimum count: 0
maximum count: 1
Text/regexp for java expression type: name of the class or interface e.g. java\.lang\.String

$arg$

minimum count: 0
maximum count: unlimited

$method$

you might want to fill in Text/regexp to restrict the search to a specific method or methods.
1

Please sign in to leave a comment.