code: public ClassGraph whitelistPackagesNonRecursive(final String... packageNames) {
          enableClassInfo();
          for (final String packageName : packageNames) {
              final String packageNameNormalized = WhiteBlackList.normalizePackageOrClassName(packageName);
              if (packageNameNormalized.contains("*")) {
                  throw new IllegalArgumentException("Cannot use a glob wildcard here: " + packageNameNormalized);
              }
              // Whitelist package, but not sub-packages
              scanSpec.packageWhiteBlackList.addToWhitelist(packageNameNormalized);
              scanSpec.pathWhiteBlackList
                      .addToWhitelist(WhiteBlackList.packageNameToPath(packageNameNormalized) + "/");
              if (packageNameNormalized.isEmpty()) {
                  scanSpec.pathWhiteBlackList.addToWhitelist("");
              }
          }
          return this;
      }
docs: Scan one or more specific packages, without recursively scanning sub-packages unless they are themselves
  whitelisted.
  
  <p>
  N.B. Automatically calls {@link #enableClassInfo()} -- call {@link #whitelistPathsNonRecursive(String...)}
  instead if you only need to scan resources.
  
  <p>
  This may be particularly useful for scanning the package root ("") without recursively scanning everything in
  the jar, dir or module.
  
  @param packageNames
  The fully-qualified names of packages to scan (with '.' as a separator). May not include a glob
  wildcard ({@code '*'}).
  
  @return this (for method chaining).