javac ast indices: fix indices state if new project is created

This commit is contained in:
Dmitry Batkovich
2017-05-03 14:52:05 +03:00
parent 1bd858aab7
commit 7c7ffb2825
@@ -144,7 +144,8 @@ public class CompilerReferenceServiceImpl extends CompilerReferenceServiceEx imp
if (!ApplicationManager.getApplication().isUnitTestMode()) {
ApplicationManager.getApplication().executeOnPooledThread(() -> {
boolean isUpToDate;
if (CompilerReferenceReader.exists(myProject)) {
boolean indexExist = CompilerReferenceReader.exists(myProject);
if (indexExist) {
CompileScope projectCompileScope = compilerManager.createProjectCompileScope(myProject);
isUpToDate = compilerManager.isUpToDate(projectCompileScope);
} else {
@@ -154,7 +155,7 @@ public class CompilerReferenceServiceImpl extends CompilerReferenceServiceEx imp
if (isUpToDate) {
openReaderIfNeed(IndexOpenReason.UP_TO_DATE_CACHE);
} else {
markAsOutdated();
markAsOutdated(indexExist);
}
});
});
@@ -586,10 +587,12 @@ public class CompilerReferenceServiceImpl extends CompilerReferenceServiceEx imp
}
}
private void markAsOutdated() {
private void markAsOutdated(boolean decrementBuildCount) {
myOpenCloseLock.lock();
try {
--myActiveBuilds;
if (decrementBuildCount) {
--myActiveBuilds;
}
myDirtyScopeHolder.upToDateChecked(false);
} finally {
myOpenCloseLock.unlock();