mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
stubs from ast don't require PsiLock, synchronize them just to prevent unnecessary concurrent calculation (IDEA-106567)
This commit is contained in:
@@ -57,7 +57,6 @@ import com.intellij.psi.tree.ILazyParseableElementType;
|
||||
import com.intellij.psi.tree.IStubFileElementType;
|
||||
import com.intellij.psi.tree.TokenSet;
|
||||
import com.intellij.reference.SoftReference;
|
||||
import com.intellij.testFramework.LightVirtualFile;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.PatchedWeakReference;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
@@ -406,9 +405,9 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
|
||||
|
||||
synchronized (PsiLock.LOCK) {
|
||||
clearStub();
|
||||
if (tree != null) {
|
||||
tree.putUserData(STUB_TREE_IN_PARSED_TREE, null);
|
||||
}
|
||||
}
|
||||
if (tree != null) {
|
||||
tree.putUserData(STUB_TREE_IN_PARSED_TREE, null);
|
||||
}
|
||||
|
||||
clearCaches();
|
||||
@@ -946,13 +945,15 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
|
||||
}
|
||||
|
||||
private static final Key<StubTree> STUB_TREE_IN_PARSED_TREE = new Key<StubTree>("STUB_TREE_IN_PARSED_TREE");
|
||||
private final Object myStubFromTreeLock = new Object();
|
||||
|
||||
public StubTree calcStubTree() {
|
||||
FileElement fileElement = calcTreeElement();
|
||||
synchronized (PsiLock.LOCK) {
|
||||
synchronized (myStubFromTreeLock) {
|
||||
StubTree tree = fileElement.getUserData(STUB_TREE_IN_PARSED_TREE);
|
||||
|
||||
if (tree == null) {
|
||||
ApplicationManager.getApplication().assertReadAccessAllowed();
|
||||
IElementType contentElementType = getContentElementType();
|
||||
if (!(contentElementType instanceof IStubFileElementType)) {
|
||||
VirtualFile vFile = getVirtualFile();
|
||||
|
||||
Reference in New Issue
Block a user