<p>invoke.</p>

@param constructor a {@link java.lang.reflect.Constructor} object.
@param args a {@link java.lang.Object} object.
@param <T> a T object.
@return a T object.
@throws java.lang.Throwable if any.
515675
public static <T> T invoke( Constructor<T> constructor, Object... args ) throws Throwable
    {
        try
        {
            return constructor.newInstance( args );
        }
        catch (InstantiationException e)
        {
            throw e.getCause();
        }
    }
1295506
public Expression invoke(MethodRef method, Expression... args) {
    return method.invoke(ImmutableList.<Expression>builder().add(this).add(args).build());
  }
549588
public Object invoke (Object object, String methodName, Class[] paramTypes, Object... args) {
		return invoke(object, getIndex(methodName, paramTypes), args);
	}
504999
private Object invoke(Class<?> objClass, Object obj, String methodName, String[] argTypes,
            Object[] args, String appId, String token) throws RpcException {
        Object res;
        try {
            MethodDescriptor<String> desc = serviceLocator
                    .getServiceDescriptor(new MethodWrapper(objClass.getName(), methodName,
                            StringUtil.toString4Array(argTypes)).toString());
            if (desc == null) {
                throw new MethodNotFoundException(String.format(
                        "Service method not found. class=%s, method=%s, argTypes=%s", objClass,
                        methodName, StringUtil.toString4Array(argTypes)));
            }

            if (!isAuthoriedAccess(desc, appId, token)) {
                throw new AuthAccessDeniedException("AppId or token is not valid to access");
            }

            res = desc.getMethod().invoke(desc.getTarget(), args);
        } catch (MethodNotFoundException e1) {
            throw new InvalidParamException(e1);
        } catch (IllegalArgumentException e1) {
            throw new InvalidParamException(e1);
        } catch (IllegalAccessException e1) {
            throw new InvalidAccessException(e1);
        } catch (AuthAccessDeniedException e1) {
            throw new RpcException(e1);
        } catch (InvocationTargetException e1) {
            Throwable e2 = e1.getTargetException();
            if (e2 instanceof RpcException) {
                throw (RpcException) e2;
            } else {
                throw new ServerErrorException(e2);
            }
        }
        if (res == void.class) {
            return null;
        } else {
            return res;
        }
    }
792911
public Object invokeMethod(String name, Object args) {
        try {
        return getMetaClass().invokeMethod(this, name, args);
        }
        catch (MissingMethodException e) {
            // lets apply the method to each item in the collection
            List answer = new ArrayList(size());
            for (Iterator iter = iterator(); iter.hasNext(); ) {
                Object element = iter.next();
                Object value = InvokerHelper.invokeMethod(element, name, args);
                answer.add(value);
            }
            return answer;
        }
    }
66716
private static <T> T createInstance(Constructor<T> constructor, Object... arguments) throws Exception {
        if (constructor == null) {
            throw new IllegalArgumentException("Constructor cannot be null");
        }
        constructor.setAccessible(true);

        T createdObject = null;
        try {
            if (constructor.isVarArgs()) {
                Class<?>[] parameterTypes = constructor.getParameterTypes();
                final int varArgsIndex = parameterTypes.length - 1;
                Class<?> varArgsType = parameterTypes[varArgsIndex].getComponentType();
                Object varArgsArrayInstance = createAndPopulateVarArgsArray(varArgsType, varArgsIndex, arguments);
                Object[] completeArgumentList = new Object[parameterTypes.length];
                System.arraycopy(arguments, 0, completeArgumentList, 0, varArgsIndex);
                completeArgumentList[completeArgumentList.length - 1] = varArgsArrayInstance;
                createdObject = constructor.newInstance(completeArgumentList);
            } else {
                createdObject = constructor.newInstance(arguments);
            }
        } catch (InvocationTargetException e) {
            Throwable cause = e.getCause();
            if (cause instanceof Exception) {
                throw (Exception) cause;
            } else if (cause instanceof Error) {
                throw (Error) cause;
            }
        }
        return createdObject;
    }
350583
public static <T> T invoke(String className, String methodName, Object[] args) {
		return invoke(className, methodName, false, args);
	}
1226900
private static MessageBuffer newInstance(Constructor<?> constructor, Object... args)
    {
        try {
            // We need to use reflection to create MessageBuffer instances in order to prevent TypeProfile generation for getInt method. TypeProfile will be
            // generated to resolve one of the method references when two or more classes overrides the method.
            return (MessageBuffer) constructor.newInstance(args);
        }
        catch (InstantiationException e) {
            // should never happen
            throw new IllegalStateException(e);
        }
        catch (IllegalAccessException e) {
            // should never happen unless security manager restricts this reflection
            throw new IllegalStateException(e);
        }
        catch (InvocationTargetException e) {
            if (e.getCause() instanceof RuntimeException) {
                // underlying constructor may throw RuntimeException
                throw (RuntimeException) e.getCause();
            }
            else if (e.getCause() instanceof Error) {
                throw (Error) e.getCause();
            }
            // should never happen
            throw new IllegalStateException(e.getCause());
        }
    }
77687
public synchronized Object invoke(Object base, Object... pars)
            throws InvocationTargetException {
        if (null == pars)
            pars = Reflect.ZERO_ARGS;
        try {
            return Primitive.wrap(
                    invokeTarget(base, pars), getReturnType());
        }
        catch (Throwable ite) {
            throw new InvocationTargetException(ite);
        }
    }
733812
public <T> T execute(final Object[] args, final Class<T> clazz) {
        return execute(args, clazz, true);
    }
342883
@Override
    public <T> T invoke(JavascriptExecutor wd, String expression, Object... args) {
        return this.<T> doInvoke(wd, expression, args);
    }
59683
function construct(constructor, args) {
            var c = function () {
                return constructor.apply(this, args);
            };
            c.prototype = constructor.prototype;
            return new c();
        }
547259
@Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        if (target == null) {
            target = JndiUtils.lookup(name);
        }
        return method.invoke(target, args);
    }
989271
@Deprecated
    private T build(Constructor<T> constructor, Object[] args) {
        try {
            return constructor.newInstance(args);

        } catch (IllegalArgumentException | IllegalAccessException | InstantiationException ex) {
            throw new IllegalArgumentException(
                    "Bean cannot be created: " + beanName() + " from " + Arrays.toString(args), ex);
        } catch (InvocationTargetException ex) {
            if (ex.getCause() instanceof RuntimeException) {
                throw (RuntimeException) ex.getCause();
            }
            throw new RuntimeException(ex);
        }
    }
727968
private static Reflect on(Constructor<?> constructor, Object... args) throws ReflectException {
        try {
            return on(constructor.getDeclaringClass(), accessible(constructor).newInstance(args));
        }
        catch (Exception e) {
            throw new ReflectException(e);
        }
    }
862945
public Object invokeMethod(final String name, final Object args) {
        return this.wrapped.invokeMethod(name, args);
    }
114792
@Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        if (throwable != null) {
            throw throwable;
        }
        try {
            return invokeInternal(proxy, method, args);
        } catch (Exception e) {
            if (this.throwable != null) {
                logger.debug("exception caught: {} overridden by: {}", e.getMessage(), throwable.getMessage());
                throw throwable;
            } else {
                throw e;
            }
        }
    }