From: jjenista Date: Mon, 1 Sep 2008 21:11:43 +0000 (+0000) Subject: prevent infinite recursion for cycle of callers X-Git-Tag: buildscript^6~69 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=0d4fc833da3828cec530da63553c868056b0a30b;p=IRC.git prevent infinite recursion for cycle of callers --- diff --git a/Robust/src/Analysis/CallGraph/CallGraph.java b/Robust/src/Analysis/CallGraph/CallGraph.java index 1c24b244..60394993 100644 --- a/Robust/src/Analysis/CallGraph/CallGraph.java +++ b/Robust/src/Analysis/CallGraph/CallGraph.java @@ -114,15 +114,26 @@ public class CallGraph { HashSet ns=new HashSet(); ns.add(d); + return getMoreMethodCalls( ns, d ); + } + + private Set getMoreMethodCalls( HashSet found, Descriptor d ) { + HashSet ns=new HashSet(); + ns.add(d); + found.add(d); Set s=(Set)mapCaller2CalleeSet.get(d); if (s!=null) for(Iterator it=s.iterator(); it.hasNext();) { MethodDescriptor md=(MethodDescriptor)it.next(); - ns.addAll(getMethodCalls(md)); + if( !found.contains(md) ) { + found.contains(md); + ns.addAll(getMoreMethodCalls(found, md)); + } } - return ns; + return ns; } + private void buildGraph() { Iterator it=state.getClassSymbolTable().getDescriptorsIterator(); while(it.hasNext()) {