IntelliJ- how to find method calls?

Viewed 7764

I have just started using IntelliJ for the first time on a project that I've just started working on, and am still getting familiar witht the setup and how it works. Previously when working on Java projects, I have predominantly used Eclipse as my IDE.

In Eclipse, when working on a particular method, there was the functionality to right-click the method, and select the option 'Find All References', to list everywhere in the project that the method was called.

I have made a few changes to the definitions of a couple of methods (the changes have mainly been in their parameters) in the project in IntelliJ, and now want to 'Find All References' on the methods, so that I can ensure that they are called with the correct parameters. However, when I right-click on the method definitions, and select 'Find Usages' from the menu, I get a popup message displaying the following warning:

Method 'abc() of class def' implements method of interface ghi. Do you want to find the usages of the base method?

Regardless of whether I select 'Yes' or 'No', the search results only return one result- the source file & line that I clicked on in order to do the search.

My guess is that there's something I need to change in the settings somewhere to ensure that doing this returns all of the places where that particular method is used in the code? I checked with a colleague, and when they do exactly the same thing, they get a list of all of the places within the project where that method is called...

How can I resolve this, so that I can find all of the method calls for the one I have highlighted?

4 Answers

I usually use Ctrl-Alt-H for Hierarchy and get a list of all callers even in tests.

By selecting the method name (double click on it) and pressing alt+ctrl+shift+f7 keys, a window named Fined Usages will popup. There is a checkbox in this window, you can check: Usages, Overriding methods, Search for text occurrences or Skip result tab with one usage. Then you can set the scope on All Places and click on Find. So, a search window appears and all classes and methods that called this method are listed there.

Alternatively, you can use "Find in path" option which lets you search for a raw string in any files in the project (although it's of course configurable). It is under Ctrl-Shift-F.

Related