possible bug in PolyVariantReferenceBase.isReferenceTo() method implementation

hello,
I think there is a possible bug in PolyVariantReferenceBase.isReferenceTo() method implementation :

@Override
  public boolean isReferenceTo(PsiElement element) {
    final ResolveResult[] results = multiResolve(false);
    for (ResolveResult result : results) {
      if (getElement().getManager().areElementsEquivalent(result.getElement(), element)) { <--- this line throws a PsiInvalidElementAccessException
        return true;
      }
    }
    return false;
  }

I marked the problematic line : when trying to verify element equivalence, the 'old' element (target element being referenced) has already been invalidated and causes comparison failure due to the exception mentioned above.
Shouldn't 'isReferenceTo' be called before the renamed psielement has been replaced with a new one and when it is still valid and 'usable' ?

---
Original message URL: http://devnet.jetbrains.net/message/5513161#5513161

0

Please sign in to leave a comment.