code: private static ClassLoader extensionClassLoader(final ClassLoader environment) {
      ClassLoader cl = environment;
      ClassLoader prev = null;
      while (cl != null) {
        prev = cl;
        cl = cl.getParent();
      }
      return prev;
    }
docs: Attempt to get the extension class loader, which can only load jdk classes and classes from
  jvm
  extensions. Adapted from {@link ServiceLoader#loadInstalled(Class)}