Les appelants d'une méthodes
Bonjour,
J'aimerais trouver tous les appelants de chaque méthode dans un projet Java. J'ai trouvé un code sur net et c'est exactement ce que je veux faire mais il me génère une erreur et je n'arrive pas à en trouver la cause
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| public HashSet<IMethod> getCallersOf(IMethod m) {
CallHierarchy callHierarchy = CallHierarchy.getDefault();
IMember[] members = {m};
MethodWrapper[] methodWrappers = callHierarchy.getCallerRoots(members);
HashSet<IMethod> callers = new HashSet<IMethod>();
for (MethodWrapper mw : methodWrappers) {
MethodWrapper[] mw2 = mw.getCalls(new NullProgressMonitor());
HashSet<IMethod> temp = getIMethods(mw2);
callers.addAll(temp);
}
return callers;
} |
Pour tester :
"met" est une liste contenant toutes les méthodes du projet à analyser ( public static List<Method> met ):
Code:
1 2
| for (int i = 0; i < met.size(); i++)
HashSet<Method> calls = TestingCalls.getCallersOf(met.get(i)); |
et voici l'erreur :
Citation:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
callHierarchy cannot be resolved to a type
IMethod cannot be resolved to a type
Quelqu'un saurait-il m'indiquer d'où vient le problème ?
Merci d'avance pour votre aide.