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
Pour tester :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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; }
"met" est une liste contenant toutes les méthodes du projet à analyser ( public static List<Method> met ):et voici l'erreur :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 for (int i = 0; i < met.size(); i++) HashSet<Method> calls = TestingCalls.getCallersOf(met.get(i));Quelqu'un saurait-il m'indiquer d'où vient le problème ?Exception in thread "main" java.lang.Error: Unresolved compilation problems:
callHierarchy cannot be resolved to a type
IMethod cannot be resolved to a type
Merci d'avance pour votre aide.
Partager