abstract class Base {}
class A extends Base
class B extends Base
How do I find all places in the code that create Base? (that is, have either new A()
or new B()
)
UPDATE
To make it clear, the above is just and example. I'm interested in a way of searching for object creation of any class, including 3rd party classes that I don't control.
By default, IntelliJ IDEA shows all classes, methods, and other elements of the current file. To toggle the elements you want to show, click the corresponding buttons on the Structure tool window toolbar. to show class fields.
Select a symbol for which you want to find usages, right-click the symbol, and select Find Usages from its context menu or press Alt+F7 . Check the results in the Find tool window. ) the results by files, packages, directories, and so on. on the toolbar in the Find tool window or press Ctrl+Alt+Shift+F7 .
Use ⇧⇧ (macOS), or Shift+Shift (Windows/Linux), to bring up the Search Everywhere dialog. You can search across Classes, Files, Symbols and Actions. You can also use forward slash to filter the results to a specific area, such as /editor.
or select File | Project Structure ( Ctrl+Alt+Shift+S ) from the main menu.
Using Structural Search (Edit -> Find -> Search Structurally):
new $Type$($P$)
Voila!
IttayD if I have understood correctly your latest update, what I normally do (IntelliJ 9.0.4) if I have a similar need to yours is Right click on class name and do "Find Usages" and this will list results in the form of usage categories,
As far as I'm aware I do not think there is a specific option/selection choice to fulfill such a usage search check. Thanks
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With