Search in sources :

Example 6 with PsiInvalidElementAccessException

use of com.intellij.psi.PsiInvalidElementAccessException in project intellij-community by JetBrains.

the class ResolveResultList method poke.

// Allows to add non-null elements and discard nulls in a hassle-free way.
public boolean poke(final PsiElement what, final int rate) {
    PyPsiUtils.assertValid(what);
    if (what == null)
        return false;
    if (!(what instanceof LightElement) && !what.isValid()) {
        throw new PsiInvalidElementAccessException(what, "Trying to resolve a reference to an invalid element");
    }
    super.add(new RatedResolveResult(rate, what));
    return true;
}
Also used : PsiInvalidElementAccessException(com.intellij.psi.PsiInvalidElementAccessException) RatedResolveResult(com.jetbrains.python.psi.resolve.RatedResolveResult) LightElement(com.intellij.psi.impl.light.LightElement)

Aggregations

PsiInvalidElementAccessException (com.intellij.psi.PsiInvalidElementAccessException)6 NotNull (org.jetbrains.annotations.NotNull)3 PsiElement (com.intellij.psi.PsiElement)2 Project (com.intellij.openapi.project.Project)1 PsiDirectory (com.intellij.psi.PsiDirectory)1 PsiFile (com.intellij.psi.PsiFile)1 PsiNamedElement (com.intellij.psi.PsiNamedElement)1 PsiManagerEx (com.intellij.psi.impl.PsiManagerEx)1 LightElement (com.intellij.psi.impl.light.LightElement)1 PsiFileImpl (com.intellij.psi.impl.source.PsiFileImpl)1 SubstrateRef (com.intellij.psi.impl.source.SubstrateRef)1 FileElement (com.intellij.psi.impl.source.tree.FileElement)1 XmlTag (com.intellij.psi.xml.XmlTag)1 DomStub (com.intellij.util.xml.stubs.DomStub)1 StubParentStrategy (com.intellij.util.xml.stubs.StubParentStrategy)1 RatedResolveResult (com.jetbrains.python.psi.resolve.RatedResolveResult)1 ArrayList (java.util.ArrayList)1