public static HighlightInfo.Builder checkFragmentError(PsiFragment fragment) {
    String text = InjectedLanguageManager.getInstance(fragment.getProject()).getUnescapedText(fragment);
    if (fragment.getTokenType() == JavaTokenType.TEXT_BLOCK_TEMPLATE_BEGIN) {
      final HighlightInfo.Builder info1 = checkTextBlockNewlineAfterOpeningQuotes(fragment, text, null);
      if (info1 != null) return info1;
    }
    int length = text.length();
    if (fragment.getTokenType() == JavaTokenType.STRING_TEMPLATE_END) {
      if (!StringUtil.endsWithChar(text, '\"') || length == 1) {
        return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR)
          .range(fragment)
          .descriptionAndTooltip(JavaErrorBundle.message("illegal.line.end.in.string.literal"));
      }
    }
    if (text.endsWith("\\{")) {
      text = text.substring(0, length - 2);
      length -= 2;
    }
    StringBuilder chars = new StringBuilder(length);
    int[] offsets = new int[length + 1];
    boolean success = CodeInsightUtilCore.parseStringCharacters(text, chars, offsets, fragment.isTextBlock());
    if (!success) {
      String message = JavaErrorBundle.message("illegal.escape.character.in.string.literal");
      return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR)
        .range(fragment, calculateErrorRange(text, offsets[chars.length()]))
        .descriptionAndTooltip(message);
    }
    return null;
  }
public static HighlightInfo.Builder checkFragmentError(PsiFragment fragment)