Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding where class constructors are called in IDEA

In Eclipse, you can focus on class XXX and press Ctrl+Alt+H, to get a call hierarchy showing everywhere that new XXX(...) is called.

In IntelliJ IDEA, I can only do this on each constructor separately, and I can't do it at all on the default constructor (invisible).

Is there a way in IDEA that I'm missing? (Ultimate 12.1.3)

like image 478
Iain Avatar asked Oct 11 '13 01:10

Iain


1 Answers

If I'm understanding your question correctly - one way you can do this is to select the classname (instead of an individual constructor name) and press Alt+F7 (Find usages).

This will find all usages of that class - the "Found Usages" window that will be displayed is split up into expandable sections, one of which will be "new instance creation".

NOTE: if you can't see a New instance creation grouping, makes sure Group by usage type is enabled (the "funnel" looking icon in the screen shot below).

In IDEA 2017.2, it looks like this:

enter image description here

like image 198
Shorn Avatar answered Oct 25 '22 15:10

Shorn