code: static public void scanRoot(File root,
                                  Set<String> suffixes,
                                  List<String> excludes, List<String> includes,
                                  List<String> excludeFiles, List<String> includeFiles,
                                  Map<String,Source> foundFiles,
                                  Map<String,Module> foundModules,
                                  Module currentModule,
                                  boolean permitSourcesWithoutPackage,
                                  boolean inGensrc,
                                  boolean inLinksrc)
          throws ProblemException {
  
          if (root == null) return;
          int root_prefix = root.getPath().length()+1;
          // This is the root source directory, it must not contain any Java sources files
          // because we do not allow Java source files without a package.
          // (Unless of course --permit-sources-without-package has been specified.)
          // It might contain other source files however, (for -tr and -copy) these will
          // always be included, since no package pattern can match the root directory.
          currentModule = addFilesInDir(root, root_prefix, root, suffixes, permitSourcesWithoutPackage,
                                         excludeFiles, includeFiles, false,
                                         foundFiles, foundModules, currentModule,
                                         inGensrc, inLinksrc);
  
          File[] dirfiles = root.listFiles();
          for (File d : dirfiles) {
              if (d.isDirectory()) {
                  // Descend into the directory structure.
                  scanDirectory(d, root_prefix, root, suffixes,
                                excludes, includes, excludeFiles, includeFiles,
                                false, foundFiles, foundModules, currentModule, inGensrc, inLinksrc);
              }
          }
      }
docs: Recurse into the directory root and find all files matchine the excl/incl/exclfiles/inclfiles rules.
  Detects the existence of module-info.java files and presumes that the directory it resides in
  is the name of the current module.