refine hasExceptions(): return true if there are *uncaught* exceptions

This commit is contained in:
Martin Mohr 2015-07-27 14:15:12 +02:00
parent 8d143dbf20
commit 65b9e97ae5
2 changed files with 4 additions and 3 deletions

View File

@ -59,9 +59,10 @@ public interface ExceptionPruningAnalysis<I, T extends IBasicBlock<I>> {
/**
* Returns true if the corresponding method contains instructions that may
* throw an exception. Run compute(IPrograssMonitor) first.
* throw an exception which is not caught in the same method.
* Run compute(IPrograssMonitor) first.
* @return true if the corresponding method contains instructions that may
* throw an exception.
* throw an exception which is not caught in the same method
*/
boolean hasExceptions();

View File

@ -85,7 +85,7 @@ public class ExplodedCFGNullPointerAnalysis implements ExceptionPruningAnalysis<
for (IExplodedBasicBlock bb : cfg) {
if (bb.getInstruction() == null) continue;
List<IExplodedBasicBlock> succ = cfg.getExceptionalSuccessors(bb);
if (succ != null && !succ.isEmpty()) {
if (succ != null && succ.contains(cfg.exit())) {
hasException = true;
break;
}