X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=Robust%2Fsrc%2FAnalysis%2FSSJava%2FMethodAnnotationCheck.java;h=f05fcff0fad2396e47046a74029e713eb1c46a86;hb=b2f0e67f6ba3340e0c14b81770efd7491fa4ef40;hp=f8145c56a3607c697decace0796dafd76a79cce2;hpb=abce04f951b03de05f4030f53d10fdba3d20bc93;p=IRC.git diff --git a/Robust/src/Analysis/SSJava/MethodAnnotationCheck.java b/Robust/src/Analysis/SSJava/MethodAnnotationCheck.java index f8145c56..f05fcff0 100644 --- a/Robust/src/Analysis/SSJava/MethodAnnotationCheck.java +++ b/Robust/src/Analysis/SSJava/MethodAnnotationCheck.java @@ -90,29 +90,19 @@ public class MethodAnnotationCheck { if (!visited.contains(p)) { visited.add(p); - if (calleeMD.getClassDesc().isInterface()) { - calleeMD.getClassDesc(); - - } - tovisit.add(calleeMD); - if (calleeMD.isAbstract()) { - Set possibleCalleeSet = - (Set) ssjava.getCallGraph().getMethods(calleeMD); - - for (Iterator iterator2 = possibleCalleeSet.iterator(); iterator2.hasNext();) { - MethodDescriptor possibleCallee = (MethodDescriptor) iterator2.next(); + Set possibleCalleeSet = + (Set) 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); } } @@ -150,6 +140,35 @@ public class MethodAnnotationCheck { } } } + + // 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 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); + } + } + } + } }