public void compile() throws CompilerException, CacheCorruptedException { Application application = ApplicationManager.getApplication(); try { if (!myFilesToCompile.isEmpty()) { if (application.isUnitTestMode()) { saveTestData(); } compileModules(buildModuleToFilesMap(myFilesToCompile)); } } catch (SecurityException e) { throw new CompilerException( CompilerBundle.message("error.compiler.process.not.started", e.getMessage()), e); } catch (IllegalArgumentException e) { throw new CompilerException(e.getMessage(), e); } finally { for (final VirtualFile file : myModuleToTempDirMap.values()) { if (file != null) { final File ioFile = new File(file.getPath()); FileUtil.asyncDelete(ioFile); } } myModuleToTempDirMap.clear(); } if (!myFilesToCompile.isEmpty() && myCompileContext.getMessageCount(CompilerMessageCategory.ERROR) == 0) { // package-info.java hack final List<TranslatingCompiler.OutputItem> outputs = new ArrayList<TranslatingCompiler.OutputItem>(); ApplicationManager.getApplication() .runReadAction( new Runnable() { public void run() { for (final VirtualFile file : myFilesToCompile) { if (PACKAGE_ANNOTATION_FILE_NAME.equals(file.getName()) && !myProcessedPackageInfos.contains(file)) { outputs.add(new OutputItemImpl(file)); } } } }); if (!outputs.isEmpty()) { mySink.add(null, outputs, VirtualFile.EMPTY_ARRAY); } } }