static HighlightInfo.Builder checkGenericCannotExtendException(@NotNull PsiReferenceList list) {
    PsiElement parent = list.getParent();
    if (parent instanceof PsiClass klass) {
      if (hasGenericSignature(klass) && klass.getExtendsList() == list) {
        PsiClass throwableClass = null;
        for (PsiJavaCodeReferenceElement refElement : list.getReferenceElements()) {
          PsiElement resolved = refElement.resolve();
          if (!(resolved instanceof PsiClass)) continue;
          if (throwableClass == null) {
            throwableClass =
              JavaPsiFacade.getInstance(klass.getProject()).findClass(CommonClassNames.JAVA_LANG_THROWABLE, klass.getResolveScope());
          }
          if (InheritanceUtil.isInheritorOrSelf((PsiClass)resolved, throwableClass, true)) {
            String message = JavaErrorBundle.message("generic.extend.exception");
            HighlightInfo.Builder info =
              HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(refElement).descriptionAndTooltip(message);
            PsiClassType classType = JavaPsiFacade.getElementFactory(klass.getProject()).createType((PsiClass)resolved);
            IntentionAction action = QuickFixFactory.getInstance().createExtendsListFix(klass, classType, false);
            info.registerFix(action, null, null, null, null);
            return info;
          }
        }
      }
    }
    else if (parent instanceof PsiMethod method && method.getThrowsList() == list) {
      for (PsiJavaCodeReferenceElement refElement : list.getReferenceElements()) {
        PsiReferenceParameterList parameterList = refElement.getParameterList();
        if (parameterList != null && parameterList.getTypeParameterElements().length != 0) {
          String message = JavaErrorBundle.message("generic.extend.exception");
          return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(refElement).descriptionAndTooltip(message);
        }
      }
    }

    return null;
  }
static HighlightInfo.Builder checkGenericCannotExtendException(@NotNull PsiReferenceList list)