static HighlightInfo.Builder checkOverrideAnnotation(@NotNull PsiMethod method,
                                               @NotNull PsiAnnotation overrideAnnotation,
                                               @NotNull LanguageLevel languageLevel) {
    if (method.hasModifierProperty(PsiModifier.STATIC)) {
      QuickFixFactory factory = QuickFixFactory.getInstance();
      return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(overrideAnnotation)
        .registerFix(factory.createDeleteFix(overrideAnnotation), null, null, null, null)
        .descriptionAndTooltip(
          JavaErrorBundle.message("static.method.cannot.be.annotated.with.override"));
    }
    try {
      MethodSignatureBackedByPsiMethod superMethod = SuperMethodsSearch.search(method, null, true, false).findFirst();
      PsiClass psiClass = method.getContainingClass();
      if (psiClass != null) {
        if (superMethod != null && psiClass.isInterface()) {
          PsiMethod psiMethod = superMethod.getMethod();
          PsiClass superClass = psiMethod.getContainingClass();
          if (superClass != null &&
              CommonClassNames.JAVA_LANG_OBJECT.equals(superClass.getQualifiedName()) &&
              psiMethod.hasModifierProperty(PsiModifier.PROTECTED)) {
            superMethod = null;
          }
        } else if (superMethod == null) {
          if (IncompleteModelUtil.isIncompleteModel(psiClass)) {
            if (!IncompleteModelUtil.isHierarchyResolved(psiClass)) {
              return null;
            }
          } else {
            for (PsiClassType type : psiClass.getSuperTypes()) {
              // There's an unresolvable superclass: likely the error on @Override is induced.
              // Do not show an error on override, as it's reasonable to fix hierarchy first.
              if (type.resolve() == null) return null;
            }
          }
        }
      }
      if (superMethod == null) {
        if (JavaPsiRecordUtil.getRecordComponentForAccessor(method) != null) {
          return null;
        }
        String description = JavaErrorBundle.message("method.does.not.override.super");
        HighlightInfo.Builder builder =
          HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(overrideAnnotation).descriptionAndTooltip(description);
        List<IntentionAction> registrar = new ArrayList<>();
        QuickFixFactory factory = QuickFixFactory.getInstance();
        factory.registerPullAsAbstractUpFixes(method, registrar);
        for (IntentionAction action : registrar) {
          builder.registerFix(action, null, null, null, null);
        }
        builder.registerFix(factory.createDeleteFix(overrideAnnotation), null, null, null, null);
        return builder;
      }
      PsiClass superClass = superMethod.getMethod().getContainingClass();
      if (superClass != null && superClass.isInterface()) {
        return HighlightUtil.checkFeature(overrideAnnotation, JavaFeature.OVERRIDE_INTERFACE, languageLevel,
                                   overrideAnnotation.getContainingFile());
      }
      return null;
    }
    catch (IndexNotReadyException e) {
      return null;
    }
  }
static HighlightInfo.Builder checkOverrideAnnotation(@NotNull PsiMethod method,
                                               @NotNull PsiAnnotation overrideAnnotation,
                                               @NotNull LanguageLevel languageLevel)