boolean (PsiVariable parameter, PsiCatchSection catchSection) { final PsiTryStatement tryStatement = catchSection.getTryStatement(); final PsiCatchSection[] catchSections = tryStatement.getCatchSections(); int index = 0; while (catchSections[index] != catchSection) { index++; } final PsiType type = parameter.getType(); final Set<PsiClass> parameterClasses = new HashSet<>(); processExceptionClasses(type, aClass -> { parameterClasses.add(aClass); return true; }); if (parameterClasses.isEmpty()) { return false; } final Ref<Boolean> superClassExceptionType = new Ref<>(Boolean.FALSE); for (int i = index; i < catchSections.length; i++) { final PsiCatchSection nextCatchSection = catchSections[i]; final PsiParameter nextParameter = nextCatchSection.getParameter(); if (nextParameter == null) { continue; } final PsiType nextType = nextParameter.getType(); processExceptionClasses(nextType, aClass -> { for (PsiClass parameterClass : parameterClasses) { if (parameterClass.isInheritor(aClass, true)) { superClassExceptionType.set(Boolean.TRUE); return false; } } return true; }); if (superClassExceptionType.get().booleanValue()) { return true; } } return false; }