PsiElement (PsiPolyVariantReference reference) { List<PsiElement> resolvedElements = new ArrayList<>(); if (reference != null) { 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; }