private void generateSuperMethodsSection(StringBuilder buffer, PsiMethod method, boolean overrides) {
    PsiClass parentClass = method.getContainingClass();
    if (parentClass == null) return;
    if (parentClass.isInterface() && !overrides) return;
    PsiMethod[] supers = method.findSuperMethods();
    Arrays.sort(supers, Comparator.comparing(m -> {
      PsiClass aClass = m.getContainingClass();
      return aClass == null ? null : aClass.getName();
    }));
    if (supers.length == 0) return;
    boolean headerGenerated = false;
    for (PsiMethod superMethod : supers) {
      boolean isAbstract = superMethod.hasModifierProperty(PsiModifier.ABSTRACT);
      if (overrides) {
        if (parentClass.isInterface() != isAbstract) continue;
      }
      else {
        if (!isAbstract) continue;
      }
      PsiClass superClass = superMethod.getContainingClass();
      if (superClass == null) continue;
      if (!headerGenerated) {
        startHeaderSection(buffer, JavaBundle.message(overrides ? "javadoc.method.overrides" : "javadoc.method.specified.by"));
        buffer.append("<p>");
        headerGenerated = true;
      }
      else {
        buffer.append(BR_TAG);
      }

      StringBuilder methodBuffer = new StringBuilder();
      generateLink(
        methodBuffer, superMethod,
        getStyledSpan(doSemanticHighlightingOfLinks(),
                      getHighlightingManager().getMethodDeclarationAttributes(superMethod), superMethod.getName()), false);
      StringBuilder classBuffer = new StringBuilder();
      generateLink(classBuffer, superClass,
                   getStyledSpan(doSemanticHighlightingOfLinks(),
                                 getHighlightingManager().getClassDeclarationAttributes(superClass), superClass.getName()), false);
      if (superClass.isInterface()) {
        buffer.append(JavaBundle.message("javadoc.method.in.interface", methodBuffer.toString(), classBuffer.toString()));
      }
      else {
        buffer.append(JavaBundle.message("javadoc.method.in.class", methodBuffer.toString(), classBuffer.toString()));
      }
    }
    if (headerGenerated) {
      buffer.append(DocumentationMarkup.SECTION_END);
    }
  }
private void generateSuperMethodsSection(StringBuilder buffer, PsiMethod method, boolean overrides)