boolean (@NotNull PsiFile file, boolean updateWholeFile, @NotNull HighlightInfoHolder holder, @NotNull Runnable highlight) { try { prepare(holder, file); if (updateWholeFile) { GlobalInspectionContextBase.assertUnderDaemonProgress(); Project project = file.getProject(); Document document = PsiDocumentManager.getInstance(project).getDocument(file); TextRange dirtyScope = document == null ? null : DaemonCodeAnalyzerEx.getInstanceEx(project).getFileStatusMap() .getFileDirtyScope(document, file, Pass.UPDATE_ALL); if (dirtyScope == null) dirtyScope = file.getTextRange(); RefCountHolder refCountHolder = RefCountHolder.get(file, dirtyScope); if (refCountHolder == null) { // RefCountHolder was GCed and queried again for some inner code block // "highlight.run()" can't fill it again because it runs for only a subset of elements, // so we have to restart the daemon for the whole file return false; } myRefCountHolder = refCountHolder; highlight.run(); ProgressManager.checkCanceled(); refCountHolder.storeReadyHolder(file); if (document != null) { new PostHighlightingVisitor(file, document, refCountHolder).collectHighlights(holder); } } else { myRefCountHolder = null; highlight.run(); } } finally { myUninitializedVarProblems.clear(); myFinalVarProblems.clear(); mySingleImportedClasses.clear(); mySingleImportedFields.clear(); myRefCountHolder = null; myJavaModule = null; myFile = null; myHolder = null; myPreviewFeatureVisitor = null; myDuplicateMethods.clear(); myOverrideEquivalentMethodsVisitedClasses.clear(); myExpectedReturnTypes.clear(); myInsideConstructorOfClassCache.clear(); } return true; }