Collection<PsiReference> (PsiReference[] references) { Map<TextRange, PsiReference> unresolvedReferences = new HashMap<>(); for (PsiReference reference : references) { if (!XmlHighlightVisitor.isUrlReference(reference) || !needToCheckRef(reference)) { continue; } TextRange elementRange = reference.getElement().getTextRange(); if (elementRange == null || elementRange.isEmpty()) { continue; } TextRange rangeInElement = reference.getRangeInElement(); if (unresolvedReferences.containsKey(rangeInElement) && unresolvedReferences.get(rangeInElement) == null) { continue; } if (XmlHighlightVisitor.hasBadResolve(reference, true)) { if (!reference.isSoft()) { unresolvedReferences.putIfAbsent(rangeInElement, reference); } } else { // the specific range has at least one resolved reference // no need to check any other references from that range unresolvedReferences.put(rangeInElement, null); } } return ContainerUtil.skipNulls(unresolvedReferences.values()); }