For a certain method, How to find all possible combinations of call hierarchy recursively that invoke this method

58 Views Asked by At

By using IntelliJ IDEA Find Usages feature, we will find only the first level of method usages, but I need to find all possible combinations of call hierarchy recursively that invoke this method

For example, given the below call hierarchy:

  • MyClass.myMethod() used inside both Class1.method1()and Class2.method2()
  • Class1.method1() used inside both Class3.method3() and Class4.method4()
  • Class2.method2() used inside both Class5.method5() and Class6.method6()

enter image description here

By using the Find Usages Feature, the result will show the first-level usage only:

  • MyClass.myMethod() used inside Class1.method1()
  • MyClass.myMethod() used inside Class2.method2()

But I need to find all possible combinations of call hierarchy recursively that invoke my method, so the expected answer should be like this:

  • MyClass.myMethod() used inside Class1.method1(), Class1.method1() used inside Class3.method3()
  • MyClass.myMethod() used inside Class1.method1(), Class1.method1() used inside Class4.method4()
  • MyClass.myMethod() used inside Class2.method2(), Class1.method2() used inside Class5.method3()
  • MyClass.myMethod() used inside Class2.method2(), Class1.method2() used inside Class6.method4()
1

There are 1 best solutions below

0
Ahmed Nabil On

Simply by:

  • Focus on the method
  • Then select the Navigate menu then > Call Hierarchy option
    [or use the related keyboard shortcut for Call Hierarchy according to your OS]