I want to find all the method calls in one class which are made on another class.
For example:
If class1 calls class2.Foo() but not class2.Bar() then I want to know about it.
Almost like an analysis of coupling. Is this possible with reflection?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is possible, as it is done by several IDEs (at least for Java). In any case, you’re likely to have a partially erroneous analysis. It is very difficult to determine at compile-time which methods are called in presence of method overrides in derived classes.
No, it is not possible with reflection. You need static code analysis to compute coupling metrics.