1

I have some large corporate Spring project unknown for me and I need to perform this kind of task above it:

"I have method A and method B. During the execution of method A, can method B be called?"

Well I found there is function Method Call Hierarchy in IntelliJ Idea. I can perform this function on method B and generate call hierarchy, where I can perform serarch for method A. Unfortunatelly, IntelliJ freeze during computing of this hierarchy becouse its so large and crashed after 5 hours of working.

I need Method Call Hierarchy utility with better performance than IntelliJ Idea have but I failed to find it. Can you help me?

Jurass
  • 435
  • 1
  • 5
  • 17
  • 1
    Do you really need the full hierarchy, though? Chances are you can get a decent idea of what's what by navigating with 'find definition' and 'find usages'. Additionally, I think IntelliJ can show you dependencies between packages which is probably a better overall start. – pvg Apr 01 '17 at 20:19
  • I minimalized scope of call hierarchy as much as I can, to the minimum set of modules which I'm interesting it. I can't imagine to perform manual search even with Find Usages function. That extra size of call hierarchy tree above method B that even IntellJ freeze is proof how complex/complicated this project is :/ – Jurass Apr 01 '17 at 20:24
  • Wait, are you saying it OOMs on a single 'find usages'? Also, have you tried giving it more memory? – pvg Apr 01 '17 at 20:28
  • Method call hierarchy is in fact "Find Usages above Find Usages above Find Usages etc.". It not crash during single Find Usages above method B, but after lets say 12th layer of Find Usages. I try to run IntelliJ Idea with 4096MB of memory, but it didn't crash becouse of low memory. I have been mnitoring performance during comuping process and method call hierarchy in Idea run only above one thread (which is veeery slow) and memory consumption by Idea before crash have been around 1700MB. – Jurass Apr 01 '17 at 20:35
  • 1
    Well. You can take a look at this answer http://stackoverflow.com/questions/4951517/static-analysis-of-java-call-graph for some other tools. – pvg Apr 01 '17 at 20:41

3 Answers3

1

Consider using AOP functionality for method interception and execution path modification. Spring AOP support may be enough for this. this and this questions may help

Community
  • 1
  • 1
Ivan Pronin
  • 1,768
  • 16
  • 14
0

try alt + f7, or also use debugger to use call sequence.

Java Dude
  • 454
  • 6
  • 24
  • alt + f7 - Find Usages is exactly what the Call Method Hierarchy perform above each layer of method call hierarchy tree. It's the same and it can't help me finish my task becouse that project is really complicated. – Jurass Apr 01 '17 at 20:27
0

A workaround may be to use the Debugger. Set breakpoint 1 in method A and set breakpoint 2 in method B. Then in the Breakpoints dialog configure breakpoint 1 to not suspend. And configure the breakpoint 2 to be disabled until selected breakpoint is hit and select breakpoint 1. Now run the project or some tests in the debugger and check if breakpoint 2 is hit.

Bas Leijdekkers
  • 23,709
  • 4
  • 70
  • 68