code: private static <T> T getSystemTool(Class<T> clazz, String moduleName, String className) {
          if (useLegacy) {
              try {
                  return Class.forName(className, true, ClassLoader.getSystemClassLoader()).
                      asSubclass(clazz).getConstructor().newInstance();
              } catch (ReflectiveOperationException e) {
                  throw new Error(e);
              }
          }
  
          try {
              ServiceLoader<T> sl = ServiceLoader.load(clazz, ClassLoader.getSystemClassLoader());
              for (Iterator<T> iter = sl.iterator(); iter.hasNext(); ) {
                  T tool = iter.next();
                  if (matches(tool, moduleName))
                      return tool;
              }
          } catch (ServiceConfigurationError e) {
              throw new Error(e);
          }
          return null;
      }
docs: Get an instance of a system tool using the service loader.
  @implNote         By default, this returns the implementation in the specified module.
  For limited backward compatibility, if this code is run on an older version
  of the Java platform that does not support modules, this method will
  try and create an instance of the named class. Note that implies the
  class must be available on the system class path.
  @param <T>        the interface of the tool
  @param clazz      the interface of the tool
  @param moduleName the name of the module containing the desired implementation
  @param className  the class name of the desired implementation
  @return the specified implementation of the tool