if (!visited.contains(p)) {
visited.add(p);
- if (calleeMD.getClassDesc().isInterface()) {
- calleeMD.getClassDesc();
-
- }
-
tovisit.add(calleeMD);
- if (calleeMD.isAbstract()) {
- Set<MethodDescriptor> possibleCalleeSet =
- (Set<MethodDescriptor>) ssjava.getCallGraph().getMethods(calleeMD);
-
- for (Iterator iterator2 = possibleCalleeSet.iterator(); iterator2.hasNext();) {
- MethodDescriptor possibleCallee = (MethodDescriptor) iterator2.next();
+ Set<MethodDescriptor> possibleCalleeSet =
+ (Set<MethodDescriptor>) ssjava.getCallGraph().getMethods(calleeMD);
- if (!possibleCallee.isAbstract()) {
- ssjava.addAnnotationRequire(possibleCallee);
- tovisit.add(possibleCallee);
- }
+ for (Iterator iterator2 = possibleCalleeSet.iterator(); iterator2.hasNext();) {
+ MethodDescriptor possibleCallee = (MethodDescriptor) iterator2.next();
+ if (!possibleCallee.isAbstract()) {
+ ssjava.addAnnotationRequire(possibleCallee);
+ tovisit.add(possibleCallee);
}
- } else {
- ssjava.addAnnotationRequire(calleeMD);
}
}
}
}
}
+
+ // need to check super classess if the current method is inherited from
+ // them, all of ancestor method should be annoated
+ ClassDescriptor currentCd = cd;
+ ClassDescriptor superCd = tu.getSuper(currentCd);
+ while (!superCd.getSymbol().equals("Object")) {
+ Set possiblematches = superCd.getMethodTable().getSet(md.getSymbol());
+ for (Iterator methodit = possiblematches.iterator(); methodit.hasNext();) {
+ MethodDescriptor matchmd = (MethodDescriptor) methodit.next();
+ if (md.matches(matchmd)) {
+ ssjava.addAnnotationRequire(matchmd);
+ }
+ }
+ currentCd = superCd;
+ superCd = tu.getSuper(currentCd);
+ }
+
+ Set<ClassDescriptor> superIFSet = tu.getSuperIFs(cd);
+ for (Iterator iterator = superIFSet.iterator(); iterator.hasNext();) {
+ ClassDescriptor parentInterface = (ClassDescriptor) iterator.next();
+ Set possiblematches = parentInterface.getMethodTable().getSet(md.getSymbol());
+ for (Iterator methodit = possiblematches.iterator(); methodit.hasNext();) {
+ MethodDescriptor matchmd = (MethodDescriptor) methodit.next();
+ if (md.matches(matchmd)) {
+ ssjava.addAnnotationRequire(matchmd);
+ }
+ }
+ }
+
}
}