code: private void searchSubPackage(String packageName,
                                    ListBuffer<String> packages,
                                    List<String> excludedPackages,
                                    Collection<File> pathnames) {
          if (excludedPackages.contains(packageName))
              return;
  
          String packageFilename = packageName.replace('.', File.separatorChar);
          boolean addedPackage = false;
          for (File pathname : pathnames) {
              File f = new File(pathname, packageFilename);
              String filenames[] = f.list();
              // if filenames not null, then found directory
              if (filenames != null) {
                  for (String filename : filenames) {
                      if (!addedPackage
                              && (isValidJavaSourceFile(filename) ||
                                  isValidJavaClassFile(filename))
                              && !packages.contains(packageName)) {
                          packages.append(packageName);
                          addedPackage = true;
                      } else if (isValidClassName(filename) &&
                                 (new File(f, filename)).isDirectory()) {
                          searchSubPackage(packageName + "." + filename,
                                           packages, excludedPackages, pathnames);
                      }
                  }
              }
          }
      }
docs: Recursively search all directories in path for subdirectory name.
  Add all packages found in such a directory to packages list.