diagnostics for outdated anchor in SymbolCollectingProcessor (EA-63219 - IAE: ObjectU...
authorpeter <peter@jetbrains.com>
Wed, 18 Feb 2015 17:25:52 +0000 (18:25 +0100)
committerpeter <peter@jetbrains.com>
Wed, 18 Feb 2015 18:26:47 +0000 (19:26 +0100)
java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/SymbolCollectingProcessor.java

index b5933ed64e687cdd330b399255f739b30667ed9d..8a1f32ce83f42d0309e0a9957dd9d43617c4fe4e 100644 (file)
@@ -24,7 +24,6 @@ import com.intellij.psi.scope.BaseScopeProcessor;
 import com.intellij.psi.scope.ElementClassHint;
 import com.intellij.psi.scope.JavaScopeProcessorEvent;
 import com.intellij.psi.scope.PsiScopeProcessor;
-import com.intellij.util.ObjectUtils;
 import com.intellij.util.containers.MostlySingularMultiMap;
 import org.jetbrains.annotations.NotNull;
 
@@ -83,7 +82,16 @@ public class SymbolCollectingProcessor extends BaseScopeProcessor implements Ele
 
     @NotNull
     public PsiNamedElement getElement() {
-      return (PsiNamedElement)ObjectUtils.assertNotNull(myElement.retrieve());
+      PsiElement element = myElement.retrieve();
+      if (element == null) {
+        String message = "Anchor hasn't survived: " + myElement;
+        if (myElement instanceof PsiAnchor.StubIndexReference) {
+          message += "; diagnostics=" + ((PsiAnchor.StubIndexReference)myElement).diagnoseNull();
+        }
+        throw new AssertionError(message);
+      }
+
+      return (PsiNamedElement)element;
     }
 
     public PsiElement getFileContext() {