slightly more informative message regarding unreached methods

git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@922 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
dolby-oss 2007-04-04 13:04:29 +00:00
parent bea163df41
commit 016957c461
1 changed files with 7 additions and 4 deletions

View File

@ -261,6 +261,7 @@ public abstract class IRTests extends WalaTestCase {
}
private static void dumpIR(CallGraph cg, boolean assertReachable) throws IOException {
Set unreachable = new HashSet();
WarningSet warnings = new WarningSet();
ClassHierarchy cha = cg.getClassHierarchy();
IClassLoader sourceLoader = cha.getLoader(JavaSourceAnalysisScope.SOURCE_REF);
@ -278,10 +279,8 @@ public abstract class IRTests extends WalaTestCase {
else {
Iterator nodeIter = cg.getNodes(m.getReference()).iterator();
if (!nodeIter.hasNext()) {
Trace.println("Method " + m.getReference() + " not reachable?");
if (assertReachable) {
Assert.assertTrue(m.toString(), nodeIter.hasNext());
}
Trace.println("Method " + m.getReference() + " not reachable?");
unreachable.add( m );
continue;
}
CGNode node = (CGNode) nodeIter.next();
@ -289,6 +288,10 @@ public abstract class IRTests extends WalaTestCase {
}
}
}
if (assertReachable) {
Assert.assertTrue(unreachable.toString(), unreachable.isEmpty());
}
}
private static void checkCallGraphShape(CallGraph callGraph, GraphAssertions ga) throws IOException {