@Nullable
  private PsiElement addReference(@Nullable PsiPolyVariantReference reference) {
    if (reference == null) return null;
    List<PsiElement> resolvedElements = new ArrayList<>();
    ResolveResult[] resolveResults = reference.multiResolve(false);
    for (ResolveResult resolveResult : resolveResults) {
      PsiElement element = resolveResult.getElement();
      if (element != null) {
        resolvedElements.add(element);
        RefElement refElement = getRefManager().getReference(element);
        if (refElement != null) {
          addOutReference(refElement);
          ((WritableRefElement)refElement).addInReference(this);
        }
      }
    }
    return resolvedElements.size() == 1 ? resolvedElements.get(0) : null;
  }
@Nullable
  private PsiElement addReference(@Nullable PsiPolyVariantReference reference)