private @Nullable HtmlChunk generateContainerInfo(@Nullable PsiElement element) {
    JavaDocHighlightingManager highlightingManager = JavaDocHighlightingManagerImpl.getInstance();

    @NlsSafe String ownerLink = null;
    String ownerIcon = null;

    if (element instanceof PsiPackage pkg) {
      return BOTTOM_ELEMENT
        .children(
          HtmlChunk.tag("icon").attr("src", "AllIcons.Nodes.Package"),
          HtmlChunk.nbsp(),
          HtmlChunk.tag("code").addText(pkg.getQualifiedName())
        );
    }
    else if (element instanceof PsiClass) {
      PsiFile file = element.getContainingFile();
      if (file instanceof PsiJavaFile javaFile) {
        String packageName = javaFile.getPackageName();
        if (!packageName.isEmpty()) {
          PsiPackage aPackage = JavaPsiFacade.getInstance(file.getProject()).findPackage(packageName);
          StringBuilder packageFqnBuilder = new StringBuilder();
          if (myDoSemanticHighlightingOfLinks) {
            appendStyledSpan(packageFqnBuilder, highlightingManager.getClassNameAttributes(), packageName);
          }
          else {
            packageFqnBuilder.append(packageName);
          }
          ownerLink = aPackage != null
                      ? generateLink(aPackage, packageFqnBuilder.toString())
                      : "<code>" + packageFqnBuilder + "</code>";
          ownerIcon = "AllIcons.Nodes.Package";
        }
      }
    }
    else if (element instanceof PsiMember member) {
      PsiClass parentClass = member.getContainingClass();
      if (parentClass != null && !PsiUtil.isArrayClass(parentClass)) {
        String qName = parentClass.getQualifiedName();
        if (qName != null) {
          StringBuilder classFqnBuilder = new StringBuilder();
          if (myDoSemanticHighlightingOfLinks) {
            appendStyledSpan(classFqnBuilder, highlightingManager.getClassNameAttributes(), qName);
          }
          else {
            classFqnBuilder.append(qName);
          }
          classFqnBuilder.append(generateTypeParameters(parentClass, false));
          ownerLink = generateLink(parentClass, classFqnBuilder.toString());
          ownerIcon = "AllIcons.Nodes.Class";
        }
      }
    }

    if (ownerLink != null) {
      return BOTTOM_ELEMENT
        .children(
          HtmlChunk.tag("icon").attr("src", ownerIcon),
          HtmlChunk.nbsp(),
          HtmlChunk.raw(ownerLink)
        );
    }
    return null;
  }
private @Nullable HtmlChunk generateContainerInfo(@Nullable PsiElement element)