diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/BackendCompilerWrapper.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/BackendCompilerWrapper.java index 431e1488d998..444498fcfcbb 100644 --- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/BackendCompilerWrapper.java +++ b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/BackendCompilerWrapper.java @@ -520,29 +520,25 @@ public class BackendCompilerWrapper { final List toRefresh = new ArrayList(); final Map> results = new HashMap>(); try { - ApplicationManager.getApplication().runReadAction(new Runnable() { - public void run() { - final FileTypeManager typeManager = FileTypeManager.getInstance(); - final String outputDirPath = outputDir.replace(File.separatorChar, '/'); - try { - for (final Module module : chunk.getModules()) { - for (final VirtualFile root : chunk.getSourceRoots(module)) { - final String packagePrefix = myProjectFileIndex.getPackageNameByDirectory(root); - if (LOG.isDebugEnabled()) { - LOG.debug("Building output items for " + root.getPresentableUrl() + "; output dir = " + outputDirPath + "; packagePrefix = \"" + packagePrefix + "\""); - } - buildOutputItemsList(outputDirPath, module, root, typeManager, root, packagePrefix, toRefresh, results); - } - } - } - catch (CacheCorruptedException e) { - myCompileContext.requestRebuildNextTime(CompilerBundle.message("error.compiler.caches.corrupted")); + final FileTypeManager typeManager = FileTypeManager.getInstance(); + final String outputDirPath = outputDir.replace(File.separatorChar, '/'); + try { + for (final Module module : chunk.getModules()) { + for (final VirtualFile root : chunk.getSourceRoots(module)) { + final String packagePrefix = myProjectFileIndex.getPackageNameByDirectory(root); if (LOG.isDebugEnabled()) { - LOG.debug(e); + LOG.debug("Building output items for " + root.getPresentableUrl() + "; output dir = " + outputDirPath + "; packagePrefix = \"" + packagePrefix + "\""); } + buildOutputItemsList(outputDirPath, module, root, typeManager, root, packagePrefix, toRefresh, results); } } - }); + } + catch (CacheCorruptedException e) { + myCompileContext.requestRebuildNextTime(CompilerBundle.message("error.compiler.caches.corrupted")); + if (LOG.isDebugEnabled()) { + LOG.debug(e); + } + } } finally { CompilerUtil.refreshIOFiles(toRefresh); @@ -617,11 +613,11 @@ public class BackendCompilerWrapper { paths.add(new CompiledClass(classQName, relativePathToSource, pathToClass)); } - private void updateOutputItemsList(final String outputDir, VirtualFile srcFile, + private void updateOutputItemsList(final String outputDir, final VirtualFile srcFile, VirtualFile sourceRoot, final String packagePrefix, final List filesToRefresh, Map> results, - GlobalSearchScope srcRootScope) throws CacheCorruptedException { + final GlobalSearchScope srcRootScope) throws CacheCorruptedException { final Cache newCache = myCompileContext.getDependencyCache().getNewClassesCache(); final Set paths = myFileNameToSourceMap.get(srcFile.getName()); if (paths == null || paths.isEmpty()) { @@ -638,19 +634,24 @@ public class BackendCompilerWrapper { if (!pathsEquals) { final String qName = myCompileContext.getDependencyCache().resolve(cc.qName); if (qName != null) { - final JavaPsiFacade facade = JavaPsiFacade.getInstance(myProject); - PsiClass psiClass = facade.findClass(qName, srcRootScope); - if (psiClass == null) { - final int dollarIndex = qName.indexOf("$"); - if (dollarIndex >= 0) { - final String topLevelClassName = qName.substring(0, dollarIndex); - psiClass = facade.findClass(topLevelClassName, srcRootScope); + pathsEquals = ApplicationManager.getApplication().runReadAction(new Computable() { + public Boolean compute() { + final JavaPsiFacade facade = JavaPsiFacade.getInstance(myProject); + PsiClass psiClass = facade.findClass(qName, srcRootScope); + if (psiClass == null) { + final int dollarIndex = qName.indexOf("$"); + if (dollarIndex >= 0) { + final String topLevelClassName = qName.substring(0, dollarIndex); + psiClass = facade.findClass(topLevelClassName, srcRootScope); + } + } + if (psiClass != null) { + final VirtualFile vFile = psiClass.getContainingFile().getVirtualFile(); + return vFile != null && vFile.equals(srcFile); + } + return false; } - } - if (psiClass != null) { - final VirtualFile vFile = psiClass.getContainingFile().getVirtualFile(); - pathsEquals = vFile != null && vFile.equals(srcFile); - } + }); } }