I work on large Java codebases, and Find Usages in IntelliJ IDEA answers "who calls this method?" one level at a time. To see the full chain I had to click through each caller and keep the path in my head.
I built CallGraph, a plugin that draws the whole chain as one graph.
What it does
CallGraph works on Java, Kotlin, and mixed projects. I put the caret on a method, hit generate, and get a graph of its callers, their callers, and so on.
- visualize: interactive graph of method call relationships
- navigate: click any node or edge to jump straight to the source
- explore: pan and zoom through larger graphs
- export: save the graph as a standalone HTML file
How to use it
- Right-click on a method and choose Generate Call Graph.
- Or open the CallGraph tool window (View → Tool Windows → CallGraph), place your caret on a method, and hit GENERATE.
- Or use the keyboard shortcut Alt+Shift+E (Option+Shift+E on macOS).
- Click nodes to jump to their definitions, click edges to see exactly where the call happens. Pan and zoom through larger graphs. Save as HTML to keep it.
How it works
The backend is Java. It starts from the method under the caret and runs IntelliJ's ReferencesSearchon it, then repeats that for every caller it finds. It uses the IDE's own index, so it sees the same references Find Usages does.
A popular utility method can have thousands of callers, so the search has limits. The defaults are 8 levels deep, 10 callers per node, and 150 nodes in total, with test code filtered out. All of them can be changed in the settings, and so can the direction: callers, callees, or both.
The frontend is JavaScript. vis-network renders the graph inside the JCEF browser that ships with the IDE. The two sides talk over JBCefJSQuery: the graph goes to the browser as JSON, and clicks come back to Java to open the file at the right line.
Visualize caller–callee relationships for any Java or Kotlin method. Jump straight to definitions or call sites.
IntelliJ IDEA plugin that creates a callers graph for selected methods. Issues and PRs welcome.
