mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
who gives us invalid PSI to highlight usages of? (EA-85215)
This commit is contained in:
+6
@@ -107,11 +107,17 @@ public class IdentifierHighlighterPass extends TextEditorHighlightingPass {
|
||||
} else {
|
||||
PsiReference ref = TargetElementUtil.findReference(myEditor);
|
||||
if (ref instanceof PsiPolyVariantReference) {
|
||||
if (!ref.getElement().isValid()) {
|
||||
throw new PsiInvalidElementAccessException(ref.getElement(), "Invalid element in " + ref + " of " + ref.getClass() + "; editor=" + myEditor);
|
||||
}
|
||||
ResolveResult[] results = ((PsiPolyVariantReference)ref).multiResolve(false);
|
||||
if (results.length > 0) {
|
||||
for (ResolveResult result : results) {
|
||||
PsiElement target = result.getElement();
|
||||
if (target != null) {
|
||||
if (!target.isValid()) {
|
||||
throw new PsiInvalidElementAccessException(target, "Invalid element returned from " + ref + " of " + ref.getClass() + "; editor=" + myEditor);
|
||||
}
|
||||
highlightTargetUsages(target);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user