docs: @SuppressWarnings("unchecked")
    public static <T> T newInstance(Class<T> clazz, Object... arguments) throws BugError, NoSuchBeingException, BugError
    {
      if(clazz.isInterface()) {
        throw new BugError("Attempt to create new instance for interface |%s|.", clazz);
      }
      if(clazz.isArray()) {
        throw new BugError("Attempt to create new array instance of |%s|.", clazz);
      }
      if(Modifier.isAbstract(clazz.getModifiers())) {
        throw new BugError("Attempt to create new instance for abstract class |%s|.", clazz);
      }
      if(Types.isVoid(clazz)) {
        throw new BugError("Attempt to instantiate void class.");
      }
  
      try {
        Constructor<T> constructor = null;
        if(arguments.length > 0) {
          constructorsLoop: for(Constructor<?> ctor : clazz.getDeclaredConstructors()) {
            Class<?>[] parameters = ctor.getParameterTypes();
            if(parameters.length != arguments.length) {
              continue;
            }
            for(int i = 0; i < arguments.length; i++) {
              if(arguments[i] == null) {
                continue;
              }
              if(!Types.isInstanceOf(arguments[i], parameters[i])) {
                continue constructorsLoop;
              }
            }
            constructor = (Constructor<T>)ctor;
            break;
          }
          if(constructor == null) {
            throw missingConstructorException(clazz, arguments);
          }
        }
        else {
          constructor = clazz.getDeclaredConstructor();
        }
        constructor.setAccessible(true);
        return constructor.newInstance(arguments);
      }
      catch(NoSuchMethodException e) {
        throw missingConstructorException(clazz, arguments);
      }
      catch(InstantiationException | IllegalAccessException | IllegalArgumentException e) {
        throw new BugError(e);
      }
      catch(InvocationTargetException e) {
        throw new InvocationException(e);
      }
    }