code: public static SortedSet<String> getClassesForPackage(Package pkg, ClassLoader classLoader) {
          SortedSet<String> classes = new TreeSet<>(new Comparator<String>() {
             public int compare(String o1, String o2) {
                String simpleName1 = getSimpleName(o1);
                String simpleName2 = getSimpleName(o2);
                return simpleName1.compareTo(simpleName2);
             }
  
             private String getSimpleName(String className) {
                return className.substring(className.lastIndexOf('.'));
             }
          });
  
          String pkgname = pkg.getName();
          String relPath = pkgname.replace('.', '/');
  
          // Get a File object for the package
          Enumeration<URL> resources;
          try {
              resources = classLoader.getResources(relPath);
          } catch (IOException e) {
              throw new RuntimeException(e);
          }
  
          while(resources.hasMoreElements()) {
              URL resource = resources.nextElement();
              if (resource.toString().startsWith("jar:")) {
                  processJarfile(resource, pkgname, classes);
              } else {
                  processDirectory(new File(resource.getPath()), pkgname, classes);
              }
          }
  
          return classes;
      }
docs: Return all the classes in this package recursively.
  
  @param pkg the searched package
  @param classLoader class loader where to look for classes
  @return list of full class names