List<PsiCatchSection> (List<? extends PsiCatchSection> sections, @NotNull List<? extends PsiClassType> exceptionTypes, boolean isJava7OrHigher) { List<PsiCatchSection> finalSections = new ArrayList<>(); for (PsiCatchSection section : ContainerUtil.reverse(sections)) { finalSections.add(section); PsiType sectionType = section.getCatchType(); if (sectionType == null) continue; for (PsiType exceptionType : exceptionTypes) { if (exceptionType.isAssignableFrom(sectionType)) { return finalSections; // adding type to any upper leads to compilation error } } } if (!isJava7OrHigher) { // if we get to this point, this means, that we can't generify any catch clause, so we can't suggest a fix return Collections.emptyList(); } return finalSections; }