code: public static ClassLoader getClassLoader(final Class<?> clazz) {
          // Context class loader can be null
          final ClassLoader contextClassLoader = getThreadContextClassLoader();
          if (contextClassLoader != null) {
              return contextClassLoader;
          }
          if (clazz != null) {
              // The class loader for a specific class can also be null
              final ClassLoader clazzClassLoader = getClassClassLoader(clazz);
              if (clazzClassLoader != null) {
                  return clazzClassLoader;
              }
          }
          // The only class loader we can rely on for not being null is the system one
          return systemClassLoader;
      }
docs: <p>
  Try to obtain a classloader, following these priorities:
  </p>
  <ol>
  <li>If there is a <i>thread context class loader</i>, return it.</li>
  <li>Else if there is a class loader related to the class passed as argument, return it.</li>
  <li>Else return the <i>system class loader</i>.</li>
  </ol>
  
  @param clazz the class which loader will be obtained in the second step. Can be null (that will
  skip that second step).
  @return a non-null, safe classloader to use.