How do I get a list of Methods called from a Class in Eclipse IDE?

前端 未结 7 1668
眼角桃花
眼角桃花 2021-01-23 04:38

I am using Eclipse IDE for my Java project. I need a list of methods which are being called from a particular class i.e. I need to see a list of all the methods which are being

7条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-23 04:55

    The answer dependents on the context:

    If you like to have this for your code within your IDE: This depends on the IDE. In Eclipse, I believe, it is not possible. You can get the method which calls a given class (constructor of method) via "Open Call Hierarchy".

    If you like to do it at runtime: This is solvable with AspectJ, see for example http://www.eclipse.org/aspectj/doc/released/progguide/language-thisJoinPoint.html (at the end there is a piece to get the caller of any method).

提交回复
热议问题