@NotNull
  public static HighlightInfo fromAnnotation(
      @NotNull Annotation annotation, @Nullable TextRange fixedRange, boolean batchMode) {
    final TextAttributes forcedAttributes = annotation.getEnforcedTextAttributes();
    final TextAttributesKey forcedAttributesKey =
        forcedAttributes == null ? annotation.getTextAttributes() : null;

    HighlightInfo info =
        new HighlightInfo(
            forcedAttributes,
            forcedAttributesKey,
            convertType(annotation),
            fixedRange != null ? fixedRange.getStartOffset() : annotation.getStartOffset(),
            fixedRange != null ? fixedRange.getEndOffset() : annotation.getEndOffset(),
            annotation.getMessage(),
            annotation.getTooltip(),
            annotation.getSeverity(),
            annotation.isAfterEndOfLine(),
            annotation.needsUpdateOnTyping(),
            annotation.isFileLevelAnnotation(),
            0,
            annotation.getProblemGroup(),
            annotation.getGutterIconRenderer());
    appendFixes(
        fixedRange, info, batchMode ? annotation.getBatchFixes() : annotation.getQuickFixes());
    return info;
  }
 @NotNull
 @Override
 public Builder range(@NotNull TextRange textRange) {
   assert startOffset == -1 && endOffset == -1 : "Offsets already set";
   startOffset = textRange.getStartOffset();
   endOffset = textRange.getEndOffset();
   return this;
 }
 @NotNull
 public String getText() {
   RangeHighlighterEx highlighter = this.highlighter;
   if (highlighter == null) throw new RuntimeException("info not applied yet");
   if (!highlighter.isValid()) return "";
   return highlighter.getDocument().getText(TextRange.create(highlighter));
 }
 public void registerFix(
     @Nullable IntentionAction action,
     @Nullable List<IntentionAction> options,
     @Nullable String displayName,
     @Nullable TextRange fixRange,
     @Nullable HighlightDisplayKey key) {
   if (action == null) return;
   if (fixRange == null) fixRange = new TextRange(startOffset, endOffset);
   if (quickFixActionRanges == null) {
     quickFixActionRanges = ContainerUtil.createLockFreeCopyOnWriteList();
   }
   IntentionActionDescriptor desc =
       new IntentionActionDescriptor(action, options, displayName, null, key, getProblemGroup());
   quickFixActionRanges.add(Pair.create(desc, fixRange));
   fixStartOffset = Math.min(fixStartOffset, fixRange.getStartOffset());
   fixEndOffset = Math.max(fixEndOffset, fixRange.getEndOffset());
   if (action instanceof HintAction) {
     setHint(true);
   }
 }