docs: @SuppressWarnings("unchecked")
    public static <T> T instantiateGenerics(Class<?> type, String className) throws ClassInstantiationException {
      // TODO: can we do a verification that type conforms to T somehow?
      // (probably not because generics are implemented via erasure.
      try {
        try {
          return ((Class<T>) type).cast(CLASSLOADER.loadClass(className).newInstance());
        }
        catch(ClassNotFoundException e) {
          // try package of type
          return ((Class<T>) type).cast(CLASSLOADER.loadClass(type.getPackage().getName() + "." + className).newInstance());
        }
      }
      catch(InstantiationException | IllegalAccessException
          | ClassNotFoundException | ClassCastException e) {
        throw new ClassInstantiationException(e);
      }
    }