void (@NotNull PsiParameter parameter, @NotNull Consumer<? super HighlightInfo.Builder> errorSink) { if (!(parameter.getType() instanceof PsiDisjunctionType)) return; List<PsiTypeElement> typeElements = PsiUtil.getParameterTypeElements(parameter); for (int i = 0, size = typeElements.size(); i < size; i++) { PsiClass class1 = PsiUtil.resolveClassInClassTypeOnly(typeElements.get(i).getType()); if (class1 == null) continue; for (int j = i + 1; j < size; j++) { PsiClass class2 = PsiUtil.resolveClassInClassTypeOnly(typeElements.get(j).getType()); if (class2 == null) continue; boolean sub = InheritanceUtil.isInheritorOrSelf(class1, class2, true); boolean sup = InheritanceUtil.isInheritorOrSelf(class2, class1, true); if (sub || sup) { String name1 = PsiFormatUtil.formatClass(class1, PsiFormatUtilBase.SHOW_NAME | PsiFormatUtilBase.SHOW_FQ_NAME); String name2 = PsiFormatUtil.formatClass(class2, PsiFormatUtilBase.SHOW_NAME | PsiFormatUtilBase.SHOW_FQ_NAME); String message = JavaErrorBundle.message("exception.must.be.disjoint", sub ? name1 : name2, sub ? name2 : name1); PsiTypeElement element = typeElements.get(sub ? i : j); HighlightInfo.Builder builder = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(element).descriptionAndTooltip(message); IntentionAction action = getFixFactory().createDeleteMultiCatchFix(element); builder.registerFix(action, null, null, null, null); errorSink.accept(builder); break; } } } }