private static boolean areReferencesEquivalent(@NotNull PsiReference ref1, @Nullable PsiReference ref2) {
    if (ref2 == null) return false;
    if (ref1.getClass() != ref2.getClass()) return false;
    if (ref1.getElement() != ref2.getElement()) return false;
    return ref1.getRangeInElement().equals(ref2.getRangeInElement());
  }
private static boolean areReferencesEquivalent(@NotNull PsiReference ref1, @Nullable PsiReference ref2)