IDEA-88425 "Constant conditions & exceptions" inspection fails in the presence of multicatch

This commit is contained in:
peter
2012-07-09 15:04:37 +02:00
parent af1551b94b
commit b8d11bfc4f
3 changed files with 53 additions and 5 deletions
@@ -759,10 +759,18 @@ class ControlFlowAnalyzer extends JavaElementVisitor {
PsiCatchSection section = sections[i];
PsiCodeBlock catchBlock = section.getCatchBlock();
PsiParameter parameter = section.getParameter();
if (parameter != null && catchBlock != null && parameter.getType() instanceof PsiClassType &&
(!myHonorRuntimeExceptions || !ExceptionUtil.isUncheckedException((PsiClassType)parameter.getType()))) {
myCatchStack.push(new CatchDescriptor(parameter, catchBlock));
catchesPushCount++;
if (parameter != null && catchBlock != null) {
for (PsiType type : section.getPreciseCatchTypes()) {
if (type instanceof PsiClassType &&
(!myHonorRuntimeExceptions || !ExceptionUtil.isUncheckedException((PsiClassType)type))) {
myCatchStack.push(new CatchDescriptor(parameter, catchBlock));
catchesPushCount++;
}
else {
throw new CantAnalyzeException();
}
}
}
else {
throw new CantAnalyzeException();