mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
don't create new AstPath-s during switching to strong refs (EA-91128 - assert: PsiFileImpl.associateAstPathWithPsi)
This commit is contained in:
@@ -74,7 +74,6 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
|
||||
private boolean myInvalidated;
|
||||
private volatile boolean myAstLoaded;
|
||||
private volatile boolean myUseStrongRefs;
|
||||
private volatile boolean mySwitchingToStrongRefs;
|
||||
private AstPathPsiMap myRefToPsi;
|
||||
private final ThreadLocal<FileElement> myFileElementBeingLoaded = new ThreadLocal<FileElement>();
|
||||
protected final PsiManagerEx myManager;
|
||||
@@ -277,7 +276,7 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
|
||||
StubBasedPsiElementBase psi = pair.first;
|
||||
AstPath path = pair.second;
|
||||
path.getNode().setPsi(psi);
|
||||
associateAstPathWithPsi(path, psi);
|
||||
myRefToPsi.cachePsi(path, psi);
|
||||
psi.setStubIndex(i + 1);
|
||||
}
|
||||
}
|
||||
@@ -1132,8 +1131,7 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
|
||||
|
||||
public final void beforeAstChange() {
|
||||
if (!useStrongRefs()) {
|
||||
LOG.assertTrue(!mySwitchingToStrongRefs);
|
||||
mySwitchingToStrongRefs = true;
|
||||
myUseStrongRefs = true;
|
||||
myRefToPsi.switchToStrongRefs();
|
||||
|
||||
FileElement element = getTreeElement();
|
||||
@@ -1142,9 +1140,6 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
|
||||
} else {
|
||||
LOG.error("No AST; " + derefStub() + "; " + this + " of " + getClass() + "; " + getViewProvider() + " of " + getViewProvider().getClass());
|
||||
}
|
||||
|
||||
myUseStrongRefs = true;
|
||||
mySwitchingToStrongRefs = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1159,16 +1154,10 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
|
||||
|
||||
synchronized (PsiLock.LOCK) {
|
||||
psi = myRefToPsi.getCachedPsi(path);
|
||||
return psi != null ? psi : associateAstPathWithPsi(path, creator.create());
|
||||
return psi != null ? psi : myRefToPsi.cachePsi(path, creator.create());
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private StubBasedPsiElementBase<?> associateAstPathWithPsi(@NotNull AstPath path, @NotNull StubBasedPsiElementBase<?> psi) {
|
||||
LOG.assertTrue(!mySwitchingToStrongRefs);
|
||||
return myRefToPsi.cachePsi(path, psi);
|
||||
}
|
||||
|
||||
final AstPathPsiMap getRefToPsi() {
|
||||
return myRefToPsi;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user