@Nullable
  @Override
  public GlobalSearchScope getResolveScope(@NotNull VirtualFile file, @NotNull Project project) {
    // For java only! For other languages resolve may be implemented with different rules, requiring larger scope.
    FileType type = file.getFileType();
    if (type instanceof LanguageFileType langType && langType.getLanguage() == JavaLanguage.INSTANCE) {
      ProjectFileIndex index = project.isDefault() ? null : ProjectRootManager.getInstance(project).getFileIndex();
      if (index == null) {
        return GlobalSearchScope.fileScope(project, file);
      }
      if (index.isInContent(file) && !index.isInSource(file)) {
        // Limited resolve scope for all java files in module content, but not under source roots.
        // For example, java files from test data.
        // There is still a possibility to modify this scope choice with the ResolveScopeEnlarger.
        PsiFile psi = PsiManager.getInstance(project).findFile(file);
        if (psi == null || !JavaHighlightUtil.isJavaHashBangScript(psi)) {
          return GlobalSearchScope.fileScope(project, file);
        }
      }
      Module module = index.getModuleForFile(file);
      if (module != null) {
        // Specify preferred language level to support multi-release Jars
        LanguageLevel level = LanguageLevelUtil.getEffectiveLanguageLevel(module);
        boolean includeTests = TestSourcesFilter.isTestSources(file, project);
        GlobalSearchScope baseScope = GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module, includeTests);
        return new JavaVersionBasedScope(project, baseScope, level);
      }
      if (file instanceof LightVirtualFile) {
        PsiFile psi = PsiManager.getInstance(project).findFile(file);
        if (psi != null) {
          PsiFile originalFile = psi.getOriginalFile();
          // Decompiled file: return scope for the original class file
          if (originalFile != psi && originalFile.getFileType().equals(JavaClassFileType.INSTANCE)) {
            return getClassFileScope(originalFile.getVirtualFile(), project);
          }
        }
      }
    }
    else if (type.equals(JavaClassFileType.INSTANCE)) {
      return getClassFileScope(file, project);
    }
    return null;
  }
@Nullable
  @Override
  public GlobalSearchScope getResolveScope(@NotNull VirtualFile file, @NotNull Project project)