<commit_before>/*
 * @author max
 */
package com.intellij.psi.impl.search;

import com.intellij.openapi.fileTypes.StdFileTypes;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ProjectFileIndex;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.search.GlobalSearchScope;
import org.jetbrains.annotations.NotNull;

public class JavaSourceFilterScope extends GlobalSearchScope {
  private final GlobalSearchScope myDelegate;
  private final ProjectFileIndex myIndex;

  public JavaSourceFilterScope(final GlobalSearchScope delegate, final Project project) {
    super(project);
    myDelegate = delegate;
    myIndex = ProjectRootManager.getInstance(project).getFileIndex();
  }

  public boolean contains(final VirtualFile file) {
    if (myDelegate != null && !myDelegate.contains(file)) {
      return false;
    }
    if (myIndex.isInLibraryClasses(file)) {
      return true;
    }
    return StdFileTypes.JAVA == file.getFileType() && myIndex.isInSourceContent(file);
  }

  public int compare(final VirtualFile file1, final VirtualFile file2) {
    return myDelegate != null ? myDelegate.compare(file1, file2) : 0;
  }<commit_msg>stubs for .java & .groovy files in library classes aren't needed anymore<commit_after>/*
 * @author max
 */
package com.intellij.psi.impl.search;

import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.StdFileTypes;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ProjectFileIndex;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.search.GlobalSearchScope;
import org.jetbrains.annotations.NotNull;

public class JavaSourceFilterScope extends GlobalSearchScope {
  private final GlobalSearchScope myDelegate;
  private final ProjectFileIndex myIndex;

  public JavaSourceFilterScope(final GlobalSearchScope delegate, final Project project) {
    super(project);
    myDelegate = delegate;
    myIndex = ProjectRootManager.getInstance(project).getFileIndex();
  }

  public boolean contains(final VirtualFile file) {
    final FileType fileType = file.getFileType();
    return (myDelegate == null || myDelegate.contains(file)) &&
           (StdFileTypes.JAVA == fileType && myIndex.isInSourceContent(file) ||
            StdFileTypes.CLASS == fileType && myIndex.isInLibraryClasses(file));
  }

  public int compare(final VirtualFile file1, final VirtualFile file2) {
    return myDelegate != null ? myDelegate.compare(file1, file2) : 0;
  }
{'fraction_non_alphanumeric': 0.09733530717986677, 'fraction_numerical': 0.003700962250185048, 'mean_word_length': 4.966887417218543, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5562419', 'n_tokens_mistral': 808, 'n_tokens_neox': 784, 'n_words': 170}