Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellij (or other) - Possible to see a graph/tree of all calls made in Java?

I'm working on a project in Intellij Ultimate 14. I'm not looking to do a live debugging of the application to trace calls. The time it would take to follow all code paths would be insane. I'm hoping that Intellij has some kind of analysis tool that can provide me with all calls made within the project given a particular starting point or points. So if I start with method A(), and A calls B() and C(), and B calls D(), then I'd like to be able to have that information collected and exported/displayed somehow. I'd also like annotations on any method to be included and it would need to be able to resolve interfaces to implementations where possible (many interfaces have only one), or perhaps allow me to select an implementation if needed. I don't think Intellij has this sort of functionality built in beyond being able to find all callers/callees of a single specified method. Does such a tool exist?

like image 372
user1017413 Avatar asked Jun 09 '16 15:06

user1017413


People also ask

How can I see the call hierarchy in IntelliJ?

From the main menu, select Navigate | Call Hierarchy or press Ctrl+Alt+H .

What is a call graph in Java?

The Java Call Graph presents the chain of possible calls at runtime in Java. The nodes in the graph represent the project components, while the edges (arrows) represent relationships between the components. Both nodes and edges are color coded to show the type of component or relationship.

How do I get call hierarchy in Eclipse?

To find the references of a method, eclipse has a plugin called Open Call Hierarchy(Ctrl+Alt+H).

How do I get to IntelliJ profiler?

From the main menu, select File | New Projects Setup | Settings/Preferences for New Projects, and click Editor | Inspections. In the Profile list, select the profile that you want to share, apply the changes and close the dialog.


1 Answers

In IntelliJ, when your cursor on a callable method name, pressing ctrl-alt-H will bring you to "call Hierarchy" window.

Same if you prefer menu: "Navigate->call Hierarchy"

like image 188
Kent Avatar answered Oct 13 '22 00:10

Kent