@Override public void onContentReload() { ApplicationManager.getApplication().assertWriteAccessAllowed(); synchronized(myStubLock) { StubTree stubTree = SoftReference.dereference(myStub); myStub = null; if(stubTree != null) { //noinspection unchecked ((PsiFileStubImpl) stubTree.getRoot()).clearPsi("cls onContentReload"); } } synchronized(myMirrorLock) { putUserData(CLS_DOCUMENT_LINK_KEY, null); myMirrorFileElement = null; myPackageStatement = null; } }
private PsiFile reportError(StubElement stub) { ApplicationManager.getApplication().assertReadAccessAllowed(); String reason = ((PsiFileStubImpl<?>)stub).getInvalidationReason(); PsiInvalidElementAccessException exception = new PsiInvalidElementAccessException(myStub.getPsi(), "no psi for file stub " + stub + ", invalidation reason=" + reason, null); if (PsiFileImpl.STUB_PSI_MISMATCH.equals(reason)) { // we're between finding stub-psi mismatch and the next EDT spot where the file is reparsed and stub rebuilt // see com.intellij.psi.impl.source.PsiFileImpl.rebuildStub() // most likely it's just another highlighting thread accessing the same PSI concurrently and not yet canceled, so cancel it throw new ProcessCanceledException(exception); } throw exception; }
FileTrees clearStub(@Nonnull String reason) { StubTree stubHolder = derefStub(); if (stubHolder != null) { ((PsiFileStubImpl<?>)stubHolder.getRoot()).clearPsi(reason); } return new FileTrees(null, myTreeElementPointer, astLoaded, useStrongRefs); }