code: public static Class<?> loadClass(String className, byte[] code, ClassLoader classLoader) {
          checkArgNotNull(className, "className");
          checkArgNotNull(code, "code");
          checkArgNotNull(classLoader, "classLoader");
          try {
              Class<?> classLoaderBaseClass = Class.forName("java.lang.ClassLoader");
              Method defineClassMethod = classLoaderBaseClass.getDeclaredMethod("defineClass",
                      String.class, byte[].class, int.class, int.class);
  
              // protected method invocation
              defineClassMethod.setAccessible(true);
              try {
                  return (Class<?>) defineClassMethod.invoke(classLoader, className, code, 0, code.length);
              } finally {
                  defineClassMethod.setAccessible(false);
              }
          } catch (Exception e) {
              throw new RuntimeException("Could not load class '" + className + '\'', e);
          }
      }
docs: Loads the class defined with the given name and bytecode using the given class loader.
  Since package and class idendity includes the ClassLoader instance used to load a class we use reflection
  on the given class loader to define generated classes. If we used our own class loader (in order to be able
  to access the protected "defineClass" method) we would likely still be able to load generated classes,
  however, they would not have access to package-private classes and members of their super classes.
  
  @param className   the full name of the class to be loaded
  @param code        the bytecode of the class to load
  @param classLoader the class loader to use
  @return the class instance