private static boolean isValidRange(RangeMarker range) {
    return range != null && range.isValid() && range.getStartOffset() < range.getEndOffset();
  }
private static boolean isValidRange(RangeMarker range)