<commit_before>package com.intellij.codeInsight.daemon.impl;

import com.intellij.analysis.AnalysisScope;
import com.intellij.openapi.editor.colors.CodeInsightColors;
import com.intellij.codeInsight.CodeInsightUtil;
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzerSettings;
import com.intellij.codeInsight.daemon.HighlightDisplayKey;
import com.intellij.codeInsight.daemon.impl.analysis.HighlightInfoHolder;
import com.intellij.codeInsight.daemon.impl.analysis.HighlightUtil;
import com.intellij.codeInsight.daemon.impl.quickfix.QuickFixAction;
import com.intellij.codeInsight.intention.IntentionAction;
import com.intellij.codeInspection.InspectionsBundle;
import com.intellij.codeInspection.ex.InspectionManagerEx;
import com.intellij.j2ee.J2EERolesUtil;
import com.intellij.j2ee.ejb.EjbUtil;
import com.intellij.j2ee.ejb.role.EjbImplMethodRole;
import com.intellij.j2ee.ejb.role.EjbMethodRole;
import com.intellij.lang.annotation.HighlightSeverity;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.colors.EditorColorsManager;
import com.intellij.openapi.editor.colors.EditorColorsScheme;
import com.intellij.openapi.editor.markup.SeparatorPlacement;
import com.intellij.openapi.options.ShowSettingsUtil;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.IconLoader;
import com.intellij.openapi.util.TextRange;
import com.intellij.packageDependencies.DependenciesBuilder;
import com.intellij.packageDependencies.DependencyRule;
import com.intellij.packageDependencies.DependencyValidationManager;
import com.intellij.packageDependencies.ForwardDependenciesBuilder;
import com.intellij.packageDependencies.ui.DependencyConfigurable;
import com.intellij.psi.*;
import com.intellij.psi.search.PsiSearchHelper;
import com.intellij.psi.search.TodoItem;
import com.intellij.util.IncorrectOperationException;
import gnu.trove.THashSet;

import javax.swing.*;
import java.util.*;

public class GeneralHighlightingPass extends TextEditorHighlightingPass {
  private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass");
  private static final Icon OVERRIDING_METHOD_ICON = IconLoader.getIcon("/gutter/overridingMethod.png");
  private static final Icon IMPLEMENTING_METHOD_ICON = IconLoader.getIcon("/gutter/implementingMethod.png");

  private final Project myProject;
  private final PsiFile myFile;
  private final Document myDocument;
  private final int myStartOffset;
  private final int myEndOffset;
  private final boolean myUpdateAll;
  private final boolean myCompiled;

  private final HighlightVisitor[] myHighlightVisitors;

  private Collection<HighlightInfo> myHighlights = Collections.EMPTY_LIST;
  private Collection<LineMarkerInfo> myMarkers = Collections.EMPTY_LIST;

  private final DaemonCodeAnalyzerSettings mySettings = DaemonCodeAnalyzerSettings.getInstance();

  public GeneralHighlightingPass(Project project,
                                 PsiFile file,
                                 Document document,
                                 int startOffset,
                                 int endOffset,
                                 boolean isCompiled,
                                 boolean updateAll) {
    super(document);
    myProject = project;
    myFile = file;
    myDocument = document;
    myStartOffset = startOffset;
    myEndOffset = endOffset;
    myUpdateAll = updateAll;
    myCompiled = isCompiled;

    myHighlightVisitors = createHighlightVisitors();
    LOG.assertTrue(myFile.isValid());
  }

  private HighlightVisitor[] createHighlightVisitors() {
    HighlightVisitor[] highlightVisitors = myProject.getComponents(HighlightVisitor.class);
    for (final HighlightVisitor highlightVisitor : highlightVisitors) {
      highlightVisitor.init();
    }
    return highlightVisitors;
  }

  /**
   * @fabrique *
   */
  public Project getProject() {
    return myProject;
  }

  
  public void doCollectInformation(ProgressIndicator progress) {
    /*
    if (myUpdateAll){
      AlternativeWay.processFile(myFile);
    }
    */
    PsiElement[] psiRoots = myFile.getPsiRoots();

    if (myUpdateAll) {
      DaemonCodeAnalyzer daemonCodeAnalyzer = DaemonCodeAnalyzer.getInstance(myProject);
      RefCountHolder refCountHolder = daemonCodeAnalyzer.getFileStatusMap().getRefCountHolder(myDocument, myFile);
      setRefCountHolders(refCountHolder);

      PsiElement dirtyScope = daemonCodeAnalyzer.getFileStatusMap().getFileDirtyScope(myDocument, FileStatusMap.NORMAL_HIGHLIGHTERS);
      if (dirtyScope != null) {
        if (dirtyScope instanceof PsiFile) {
          refCountHolder.clear();
        }
        else {
          refCountHolder.removeInvalidRefs();
        }
      }
    }
    else {
      setRefCountHolders(null);
    }
    Collection<HighlightInfo> result = new THashSet<HighlightInfo>(100);
    try {
      for (final PsiElement psiRoot : psiRoots) {<commit_msg>cleanup<commit_after>package com.intellij.codeInsight.daemon.impl;

import com.intellij.analysis.AnalysisScope;
import com.intellij.openapi.editor.colors.CodeInsightColors;
import com.intellij.codeInsight.CodeInsightUtil;
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzerSettings;
import com.intellij.codeInsight.daemon.HighlightDisplayKey;
import com.intellij.codeInsight.daemon.impl.analysis.HighlightInfoHolder;
import com.intellij.codeInsight.daemon.impl.analysis.HighlightUtil;
import com.intellij.codeInsight.daemon.impl.quickfix.QuickFixAction;
import com.intellij.codeInsight.intention.IntentionAction;
import com.intellij.codeInspection.InspectionsBundle;
import com.intellij.codeInspection.ex.InspectionManagerEx;
import com.intellij.j2ee.J2EERolesUtil;
import com.intellij.j2ee.ejb.EjbUtil;
import com.intellij.j2ee.ejb.role.EjbImplMethodRole;
import com.intellij.j2ee.ejb.role.EjbMethodRole;
import com.intellij.lang.annotation.HighlightSeverity;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.colors.EditorColorsManager;
import com.intellij.openapi.editor.colors.EditorColorsScheme;
import com.intellij.openapi.editor.markup.SeparatorPlacement;
import com.intellij.openapi.options.ShowSettingsUtil;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.IconLoader;
import com.intellij.openapi.util.TextRange;
import com.intellij.packageDependencies.DependenciesBuilder;
import com.intellij.packageDependencies.DependencyRule;
import com.intellij.packageDependencies.DependencyValidationManager;
import com.intellij.packageDependencies.ForwardDependenciesBuilder;
import com.intellij.packageDependencies.ui.DependencyConfigurable;
import com.intellij.psi.*;
import com.intellij.psi.search.PsiSearchHelper;
import com.intellij.psi.search.TodoItem;
import com.intellij.util.IncorrectOperationException;
import gnu.trove.THashSet;

import javax.swing.*;
import java.util.*;

public class GeneralHighlightingPass extends TextEditorHighlightingPass {
  private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass");
  private static final Icon OVERRIDING_METHOD_ICON = IconLoader.getIcon("/gutter/overridingMethod.png");
  private static final Icon IMPLEMENTING_METHOD_ICON = IconLoader.getIcon("/gutter/implementingMethod.png");

  private final Project myProject;
  private final PsiFile myFile;
  private final Document myDocument;
  private final int myStartOffset;
  private final int myEndOffset;
  private final boolean myUpdateAll;
  private final boolean myCompiled;

  private final HighlightVisitor[] myHighlightVisitors;

  private Collection<HighlightInfo> myHighlights = Collections.EMPTY_LIST;
  private Collection<LineMarkerInfo> myMarkers = Collections.EMPTY_LIST;

  private final DaemonCodeAnalyzerSettings mySettings = DaemonCodeAnalyzerSettings.getInstance();

  public GeneralHighlightingPass(Project project,
                                 PsiFile file,
                                 Document document,
                                 int startOffset,
                                 int endOffset,
                                 boolean isCompiled,
                                 boolean updateAll) {
    super(document);
    myProject = project;
    myFile = file;
    myDocument = document;
    myStartOffset = startOffset;
    myEndOffset = endOffset;
    myUpdateAll = updateAll;
    myCompiled = isCompiled;

    myHighlightVisitors = createHighlightVisitors();
    LOG.assertTrue(myFile.isValid());
  }

  private HighlightVisitor[] createHighlightVisitors() {
    HighlightVisitor[] highlightVisitors = myProject.getComponents(HighlightVisitor.class);
    for (final HighlightVisitor highlightVisitor : highlightVisitors) {
      highlightVisitor.init();
    }
    return highlightVisitors;
  }

  /**
   * @fabrique *
   */
  public Project getProject() {
    return myProject;
  }

  
  public void doCollectInformation(ProgressIndicator progress) {
    PsiElement[] psiRoots = myFile.getPsiRoots();

    if (myUpdateAll) {
      DaemonCodeAnalyzer daemonCodeAnalyzer = DaemonCodeAnalyzer.getInstance(myProject);
      RefCountHolder refCountHolder = daemonCodeAnalyzer.getFileStatusMap().getRefCountHolder(myDocument, myFile);
      setRefCountHolders(refCountHolder);

      PsiElement dirtyScope = daemonCodeAnalyzer.getFileStatusMap().getFileDirtyScope(myDocument, FileStatusMap.NORMAL_HIGHLIGHTERS);
      if (dirtyScope != null) {
        if (dirtyScope instanceof PsiFile) {
          refCountHolder.clear();
        }
        else {
          refCountHolder.removeInvalidRefs();
        }
      }
    }
    else {
      setRefCountHolders(null);
    }
    Collection<HighlightInfo> result = new THashSet<HighlightInfo>(100);
    try {
      for (final PsiElement psiRoot : psiRoots) {
{'fraction_non_alphanumeric': 0.08334908334908335, 'fraction_numerical': 0.001512001512001512, 'mean_word_length': 4.399489795918368, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6003434', 'n_tokens_mistral': 3133, 'n_tokens_neox': 3067, 'n_words': 507}