synchronized void addReference(@NotNull SmartPsiElementPointerImpl<?> pointer) {
    PointerReference reference = new PointerReference(pointer, this);
    if (needsExpansion() || isTooSparse()) {
      resize();
    }

    if (references[nextAvailableIndex] != null) throw new AssertionError(references[nextAvailableIndex]);
    storePointerReference(references, nextAvailableIndex++, reference);
    size++;
    mySorted = false;
    if (((SelfElementInfo)pointer.getElementInfo()).hasRange()) {
      markerCache.rangeChanged();
    }
  }
synchronized void addReference(@NotNull SmartPsiElementPointerImpl<?> pointer)