0

This question is not a duplicate of - How do I find the caller of a method using stacktrace or reflection?

I am trying to analyze all possible paths to a particular method for my codebase. I'm envisioning something like this:

Class clazz = MyClass.class;
Method method = clazz.getMethod("myMethod");
Method[] possibleCallers = getMethodsThatInvokeMethod(method); // <-- How do I implement this

Is this possible using reflection? If not, are there any open libraries that can help?

UPDATE: For clarification, I would only like to find the possible static invocations of a given method in the project.

Community
  • 1
  • 1
Joe Degiovanni
  • 205
  • 4
  • 6
  • Not quite clear: do you want to analyze source code or byte code? – Andremoniy Aug 04 '15 at 14:11
  • @Andremoniy , I would be happy with either source code or byte code analysis as long as either approach was able to provide a complete list of potential caller methods. Does that help? – Joe Degiovanni Aug 04 '15 at 14:23

0 Answers0