Reputation: 2183
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?
Upvotes: 38
Views: 23159
Reputation: 661
There is an IntelliJ plugin called Call Graph that does this.
Upvotes: 3
Reputation: 195229
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"
Upvotes: 65
Reputation: 2309
Atlas (http://www.ensoftcorp.com/atlas) is an Eclipse plugin that can do this. There is a feature called a "smart view" that does what you described. Select the "call" relation and then click on a method name and the view will display the parent and child methods in the call graph. The graph is intereactive, so if you double click on a node or edge in the graph it jumps to the corresponding source code. There are other relationships as well such as control flow and data flow, but the call graph is what you described in your question.
Upvotes: 4
Reputation: 6491
This doesn't graph who calls whom in general, but for a given value you can see a tree of callers that produce or consume that value
There is also Navigate | Call Hierarchy that can switch between caller and callee trees using the buttons at the top.
Upvotes: 2