void generateAnnotation(
    StringBuilder buffer,
    AnnotationFormat format,
    boolean generateLink,
    boolean isForRenderedDoc,
    boolean doSyntaxHighlighting) {
    String qualifiedName = myAnnotation.getQualifiedName();
    PsiClassType type = myTargetClass != null && qualifiedName != null &&
                        JavaDocUtil.findReferenceTarget(myContext.getManager(), qualifiedName, myContext) != null
                        ? JavaPsiFacade.getElementFactory(myContext.getProject()).createType(myTargetClass, PsiSubstitutor.EMPTY)
                        : null;

    boolean isInferred = isInferred();
    boolean red = type == null && !myResolveNotPossible && !isInferred && !isExternal();

    boolean isNonCodeAnnotation = isInferred || isExternal();
    boolean highlightNonCodeAnnotations = format == AnnotationFormat.ToolTip && isNonCodeAnnotation;
    if (highlightNonCodeAnnotations) buffer.append("<b>");
    if (isInferred) buffer.append("<i>");
    if (red) buffer.append(JavaDocInfoGenerator.getSpanForUnresolvedItem());

    boolean forceShortNames = format != AnnotationFormat.JavaDocComplete;

    if (red) {
      buffer.append("@");
    }
    else {
      appendStyledSpan(doSyntaxHighlighting, isForRenderedDoc, buffer, JavaHighlightingColors.ANNOTATION_NAME_ATTRIBUTES, "@");
    }
    String name = forceShortNames ? myNameReference.getReferenceName() : myNameReference.getText();
    if (type != null && generateLink) {
      StringBuilder styledNameBuilder = new StringBuilder();
      appendStyledSpan(doSyntaxHighlighting, isForRenderedDoc, styledNameBuilder, JavaHighlightingColors.ANNOTATION_NAME_ATTRIBUTES, name);
      String styledName = styledNameBuilder.toString();
      JavaDocInfoGeneratorFactory.getBuilder(myContext.getProject())
        .setIsGenerationForRenderedDoc(isForRenderedDoc)
        .setDoHighlightSignatures(doSyntaxHighlighting)
        .create()
        .generateLink(buffer, myTargetClass, styledName, format == AnnotationFormat.JavaDocComplete);
    }
    else if (name != null) {
      appendStyledSpan(doSyntaxHighlighting, isForRenderedDoc, buffer, JavaHighlightingColors.ANNOTATION_NAME_ATTRIBUTES, name);
    }
    if (red) buffer.append("</span>");

    generateAnnotationAttributes(buffer, generateLink, isForRenderedDoc, doSyntaxHighlighting);
    if (isInferred) buffer.append("</i>");
    if (highlightNonCodeAnnotations) buffer.append("</b>");
    if (generateLink && isNonCodeAnnotation && !isForRenderedDoc && format != AnnotationFormat.ToolTip) {
      if (isInferred && ApplicationManager.getApplication().isInternal()) {
        HtmlChunk.tag("sup").child(HtmlChunk.tag("font").attr("size", 3)
                                     .attr("color", ColorUtil.toHex(JBColor.GRAY))
                                     .child(HtmlChunk.tag("i")
                                              .addRaw(JavaBundle.message("javadoc.description.inferred.annotation.hint"))))
          .appendTo(buffer);
      }
      HelpManager helpManager = HelpManager.getInstance();
      if (helpManager instanceof HelpManagerImpl) {
        String id = isInferred ? "inferred.annotations" : "external.annotations";
        String helpUrl = ApplicationManager.getApplication().isUnitTestMode() ? id : HelpManagerImpl.getHelpUrl(id);
        if (helpUrl != null) {
          HtmlChunk.link(helpUrl, DocumentationMarkup.EXTERNAL_LINK_ICON).appendTo(buffer);
        }
      }
    }
  }
void generateAnnotation(
    StringBuilder buffer,
    AnnotationFormat format,
    boolean generateLink,
    boolean isForRenderedDoc,
    boolean doSyntaxHighlighting)