code: public Class<?> loadClass(final String className, final boolean returnNullIfClassNotFound)
              throws IllegalArgumentException {
          if (closed.get()) {
              throw new IllegalArgumentException("Cannot use a ScanResult after it has been closed");
          }
          if (className == null || className.isEmpty()) {
              throw new NullPointerException("className cannot be null or empty");
          }
          try {
              return Class.forName(className, scanSpec.initializeLoadedClasses, classGraphClassLoader);
          } catch (final ClassNotFoundException | LinkageError e) {
              if (returnNullIfClassNotFound) {
                  return null;
              } else {
                  throw new IllegalArgumentException("Could not load class " + className + " : " + e);
              }
          }
      }
docs: Load a class given a class name. If ignoreExceptions is false, and the class cannot be loaded (due to
  classloading error, or due to an exception being thrown in the class initialization block), an
  IllegalArgumentException is thrown; otherwise, the class will simply be skipped if an exception is thrown.
  
  <p>
  Enable verbose scanning to see details of any exceptions thrown during classloading, even if ignoreExceptions
  is false.
  
  @param className
  the class to load.
  @param returnNullIfClassNotFound
  If true, null is returned if there was an exception during classloading, otherwise
  IllegalArgumentException is thrown if a class could not be loaded.
  @return a reference to the loaded class, or null if the class could not be loaded and ignoreExceptions is
  true.
  @throws IllegalArgumentException
  if ignoreExceptions is false, IllegalArgumentException is thrown if there were problems loading
  or initializing the class. (Note that class initialization on load is disabled by default, you
  can enable it with {@code ClassGraph#initializeLoadedClasses(true)} .) Otherwise exceptions are
  suppressed, and null is returned if any of these problems occurs.