How to find out in Eclipse if certain method is potentially invoked or reachable (directly or indirectly) from another method?
Assume I want to refactor A.one()
which can be negatively influenced by a side-effect in D.four()
. Therefore I'd like to find out if D.four()
can potentially be invoked from A.one()
. I can see which methods are called from A.one()
using the Call Hierarchy. I can navigate the call tree and eventually find that A.one()
calls B.two()
which calls C.three()
which calls D.four()
.
Is there a way in Eclipse to make this search somehow automatic?
ps. There's a "Filters..." option in Call Hierarchy Dialog, but it only hides matching names.
Select mymethod() and press ctrl + alt + h . To see some detailed Information about any method you can use this by selecting that particular Object or method and right click. you can see the "OpenCallHierarchy" ( Ctrl + Alt + H ).
Ctrl+Shift+G shows you from where the method is being called whereas Ctrl+Alt+H shows calls from the method in the workspace.
To find the references of a method, eclipse has a plugin called Open Call Hierarchy(Ctrl+Alt+H).
This is a modified version of the way you (@lexicore) found, that involves significantly less button punching (my changes in bold):
Notes
Update
Here is some documentation, where the * key is mentioned.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With