void (int offset, PsiElement element, Collection<? super PsiReference> outReferences) { PsiReference[] references; if (element instanceof HintedReferenceHost) { references = ((HintedReferenceHost)element).getReferences(new PsiReferenceService.Hints(null, offset)); } else { references = element.getReferences(); } for (PsiReference reference : references) { if (reference == null) { LOG.error("Null reference returned from " + element + " of " + element.getClass()); continue; } for (TextRange range : ReferenceRange.getRanges(reference)) { LOG.assertTrue(range != null, reference); if (range.containsOffset(offset)) { outReferences.add(reference); } } } }