getClasses

open fun getClasses(@NotNull main: @NotNull Class<out Any>, @NotNull pckg: @NotNull String): Set<Class<out Any>>(source)

Get all the classes in the main class's classloader, which are in a specific package, and aren't in any of the excluded packages.

Semantics: A class is not loaded if any of the following conditions are true: Filename includes the file name, and it's relative path from the root of the jar

  • Filename doesn't end with .class
  • Filename doesn't start with the configured package, and doesn't start with RPF's package.
  • Filename starts with any of the provided package exclusions
A file that follows the above criteria may not be loaded because:
  • It's not a class (e.g. interfaces)
The class list may be empty because:
  • The main class's code source is null

If any of the logic before the recursing throws an exception, it'll be caught and wrapped into a RuntimeException, effectively terminating the program.

Return

Set of loaded classes

Parameters

main

Main class

pckg

Package to scan