private static void checkElementRange(Document document, PsiElement element) {
    if (element != null && element.getTextRange().getEndOffset() > document.getTextLength()) {
      throw new AssertionError(DebugUtil.diagnosePsiDocumentInconsistency(element, document));
    }
  }
private static void checkElementRange(Document document, PsiElement element)