From a3ac4d3a4550a0e7d4bd37846a07c37d448a0103 Mon Sep 17 00:00:00 2001 From: sjfink Date: Wed, 13 Feb 2008 00:09:46 +0000 Subject: [PATCH] bug fix for previous bug fix git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@2570 f5eafffb-2e1d-0410-98e4-8ec43c5233c4 --- .../src/com/ibm/wala/cfg/ShrikeCFG.java | 36 ++++++++----------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/com.ibm.wala.core/src/com/ibm/wala/cfg/ShrikeCFG.java b/com.ibm.wala.core/src/com/ibm/wala/cfg/ShrikeCFG.java index 2065a730e..407317d5d 100644 --- a/com.ibm.wala.core/src/com/ibm/wala/cfg/ShrikeCFG.java +++ b/com.ibm.wala.core/src/com/ibm/wala/cfg/ShrikeCFG.java @@ -70,7 +70,7 @@ public class ShrikeCFG extends AbstractCFG { init(); computeI2BMapping(); computeEdges(); - + if (DEBUG) { System.err.println(this); } @@ -97,8 +97,7 @@ public class ShrikeCFG extends AbstractCFG { } /** - * Compute a mapping from instruction to basic block. Also, compute the blocks - * that end with a 'normal' return. + * Compute a mapping from instruction to basic block. Also, compute the blocks that end with a 'normal' return. */ private void computeI2BMapping() { instruction2Block = new int[getInstructions().length]; @@ -207,8 +206,7 @@ public class ShrikeCFG extends AbstractCFG { } /** - * Return an instruction's basic block in the CFG given the index of the - * instruction in the CFG's instruction array. + * Return an instruction's basic block in the CFG given the index of the instruction in the CFG's instruction array. */ public BasicBlock getBlockForInstruction(int index) { return getNode(instruction2Block[index]); @@ -253,11 +251,9 @@ public class ShrikeCFG extends AbstractCFG { } /** - * Add any exceptional edges generated by the last instruction in a basic - * block. + * Add any exceptional edges generated by the last instruction in a basic block. * - * @param last - * the last instruction in a basic block. + * @param last the last instruction in a basic block. */ private void addExceptionalEdges(Instruction last) { IClassHierarchy cha = getMethod().getClassHierarchy(); @@ -307,6 +303,9 @@ public class ShrikeCFG extends AbstractCFG { if (hs[j].getCatchClass() != null) { ClassLoaderReference loader = ShrikeCFG.this.getMethod().getDeclaringClass().getReference().getClassLoader(); caughtException = ShrikeUtil.makeTypeReference(loader, hs[j].getCatchClass()); + if (DEBUG) { + System.err.println(" caughtException " + caughtException); + } IClass caughtClass = cha.lookupClass(caughtException); if (caughtClass == null) { // conservatively add the edge, and raise a warning @@ -314,13 +313,14 @@ public class ShrikeCFG extends AbstractCFG { Warnings.add(FailedExceptionResolutionWarning.create(caughtException)); // null out caughtException, to avoid attempting to process it caughtException = null; - } else { - // hs[j].getCatchClass() == null. - // this means that the handler catches all exceptions. - // add the edge and null out all types - addExceptionalEdgeTo(b); - exceptionTypes.clear(); } + } else { + // hs[j].getCatchClass() == null. + // this means that the handler catches all exceptions. + // add the edge and null out all types + addExceptionalEdgeTo(b); + exceptionTypes.clear(); + caughtException = null; } if (caughtException != null) { // the set "caught" should be the set of exceptions that MUST @@ -386,7 +386,6 @@ public class ShrikeCFG extends AbstractCFG { addExceptionalEdge(this, b); } - public int getLastInstructionIndex() { if (this == entry() || this == exit()) { // these are the special end blocks @@ -472,17 +471,14 @@ public class ShrikeCFG extends AbstractCFG { return s.toString(); } - public int getMaxStackHeight() { return method.getMaxStackHeight(); } - public int getMaxLocals() { return method.getMaxLocals(); } - public Set getExceptionHandlers() { return exceptionHandlers; } @@ -501,8 +497,6 @@ public class ShrikeCFG extends AbstractCFG { } /** - * @author sfink - * * A warning when we fail to resolve the type of an exception */ private static class FailedExceptionResolutionWarning extends Warning {