void collectHighlights(@NotNull HighlightInfoHolder holder) {
    ApplicationManager.getApplication().assertIsNonDispatchThread();

    HighlightDisplayKey unusedImportKey = HighlightDisplayKey.find(UnusedImportInspection.SHORT_NAME);
    PsiJavaFile javaFile = ObjectUtils.tryCast(myFile, PsiJavaFile.class);
    PsiImportList importList = javaFile == null ? null : javaFile.getImportList();
    if (unusedImportKey != null && isUnusedImportEnabled(unusedImportKey) && importList != null) {
      PsiImportStatementBase[] imports = importList.getAllImportStatements();
      for (PsiImportStatementBase statement : imports) {
        ProgressManager.checkCanceled();
        processImport(holder, javaFile, statement, unusedImportKey);
      }
    }

    if (errorFound) {
      DaemonCodeAnalyzerEx daemonCodeAnalyzer = DaemonCodeAnalyzerEx.getInstanceEx(myProject);
      FileStatusMap fileStatusMap = daemonCodeAnalyzer.getFileStatusMap();
      fileStatusMap.setErrorFoundFlag(myProject, myDocument, true);
    }
    IntentionAction fix = myOptimizeImportsFix;
    if (fix != null) {
      OptimizeImportRestarter.getInstance(myProject).scheduleOnDaemonFinish(myFile, fix);
    }
    HighlightDisplayKey misSortedKey = HighlightDisplayKey.find(MissortedImportsInspection.SHORT_NAME);
    if (misSortedKey != null && isToolEnabled(misSortedKey) && fix != null && importList != null) {
      holder.add(HighlightInfo.newHighlightInfo(JavaHighlightInfoTypes.MISSORTED_IMPORTS)
        .range(importList)
        .registerFix(fix, null, HighlightDisplayKey.getDisplayNameByKey(misSortedKey), null, misSortedKey)
        .create());
    }
  }
void collectHighlights(@NotNull HighlightInfoHolder holder)