@Override
  public @NotNull DirectoryProcessingResult detectRoots(@NotNull File dir,
                                                        File @NotNull [] children,
                                                        @NotNull File base,
                                                        @NotNull List<DetectedProjectRoot> result) {
    final String fileExtension = getFileExtension();
    if (JavaFileType.DEFAULT_EXTENSION.equals(fileExtension)) {
      for (File child : children) {
        if (child.isFile() && "module-info.java".equals(child.getName())) {
          JavaModuleSourceRoot sourceRoot = new JavaModuleSourceRoot(dir, getLanguageName(), true);
          result.add(sourceRoot);
          return DirectoryProcessingResult.SKIP_CHILDREN;
        }
      }
    }

    for (File child : children) {
      if (child.isFile() && FileUtilRt.extensionEquals(child.getName(), fileExtension)) {
        Pair<File, String> root = CommonSourceRootDetectionUtil.IO_FILE.suggestRootForFileWithPackageStatement(
          child, base, getPackageNameFetcher(), true);
        if (root != null) {
          JavaModuleSourceRoot sourceRoot = new JavaModuleSourceRoot(root.getFirst(), root.getSecond(), getLanguageName());
          result.add(sourceRoot);
          // Sometimes, test data .java files have a package statement which includes names of all parent directories
          // (e.g. files in jdk/test/java/awt/regtesthelpers in JDK sources have the package `test.java.awt.regtesthelpers`).
          // This check allows us to not skip searching for other java source roots when the first such file is found.
          if (areLastRootsTheSame(result, sourceRoot)) {
            return DirectoryProcessingResult.skipChildrenAndParentsUpTo(root.getFirst());
          }
        }
        return DirectoryProcessingResult.SKIP_CHILDREN;
      }
    }
    return DirectoryProcessingResult.PROCESS_CHILDREN;
  }
@Override
  public @NotNull DirectoryProcessingResult detectRoots(@NotNull File dir,
                                                        File @NotNull [] children,
                                                        @NotNull File base,
                                                        @NotNull List<DetectedProjectRoot> result)