Java Code Examples for java.lang.reflect.Method.isVarArgs()

The following are Jave code examples for showing how to use isVarArgs() of the java.lang.reflect.Method class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Pogamut3   File: ParamsMethod.java   View Source Code Vote up 6 votes
/**
 * Filter all methods to ensure following conditions:
 *
 * <ul><li>Method name is @name</li>
 *
 * <li>Method is <tt>public<tt></li>
 *
 * <li>Method is not <tt>abstract</tt></li>.
 *
 * <li>Method does not have variable number of arguments</li>
 *
 * <li>Return type of method is @returnType</li>
 *
 * <li>All parameter fields are of type {@link String}, {@link Integer} or {@link Double}</li>
 *
 * <li>All parameters are annotated with {@link Param}</li> </ul>
 *
 * @param methods Array of methods to be filtered.
 * @param seekedName Name of the methods we are looking for.
 * @param returnType Expected return type of filtered methods.
 * @return Array of methods with @name.
 */
private Method[] filterMethods(Method[] methods, String seekedName, Class<?> returnType) {
    List<Method> filteredMethods = new LinkedList<Method>();

    for (Method testedMethod : methods) {
        String testedMethodName = testedMethod.getName();
        boolean methodIsPublic = (testedMethod.getModifiers() & Modifier.PUBLIC) == Modifier.PUBLIC;
        boolean methodIsAbstract = (testedMethod.getModifiers() & Modifier.ABSTRACT) == Modifier.ABSTRACT;
        boolean correctReturnType = returnType.isAssignableFrom(testedMethod.getReturnType());
        boolean acceptedParams = areParamsAcceptable(testedMethod, true, allowedParamClasses);
        boolean annotatedParams = areParamsAnnotated(testedMethod);

        if (testedMethodName.equals(seekedName)
                && methodIsPublic
                && !methodIsAbstract
                && !testedMethod.isVarArgs()
                && correctReturnType
                && acceptedParams
                && annotatedParams) {
            filteredMethods.add(testedMethod);
        }
    }
    return filteredMethods.toArray(new Method[filteredMethods.size()]);
}
 
Example 2
Project: OpenJSharp   File: MethodElementHandler.java   View Source Code Vote up 6 votes
/**
 * Returns the result of method execution.
 *
 * @param type  the base class
 * @param args  the array of arguments
 * @return the value of this element
 * @throws Exception if calculation is failed
 */
@Override
protected ValueObject getValueObject(Class<?> type, Object[] args) throws Exception {
    Object bean = getContextBean();
    Class<?>[] types = getArgumentTypes(args);
    Method method = (type != null)
            ? MethodFinder.findStaticMethod(type, this.name, types)
            : MethodFinder.findMethod(bean.getClass(), this.name, types);

    if (method.isVarArgs()) {
        args = getArguments(args, method.getParameterTypes());
    }
    Object value = MethodUtil.invoke(method, bean, args);
    return method.getReturnType().equals(void.class)
            ? ValueObjectImpl.VOID
            : ValueObjectImpl.create(value);
}
 
Example 3
Project: jdk8u-jdk   File: MethodElementHandler.java   View Source Code Vote up 6 votes
/**
 * Returns the result of method execution.
 *
 * @param type  the base class
 * @param args  the array of arguments
 * @return the value of this element
 * @throws Exception if calculation is failed
 */
@Override
protected ValueObject getValueObject(Class<?> type, Object[] args) throws Exception {
    Object bean = getContextBean();
    Class<?>[] types = getArgumentTypes(args);
    Method method = (type != null)
            ? MethodFinder.findStaticMethod(type, this.name, types)
            : MethodFinder.findMethod(bean.getClass(), this.name, types);

    if (method.isVarArgs()) {
        args = getArguments(args, method.getParameterTypes());
    }
    Object value = MethodUtil.invoke(method, bean, args);
    return method.getReturnType().equals(void.class)
            ? ValueObjectImpl.VOID
            : ValueObjectImpl.create(value);
}
 
Example 4
Project: openjdk-jdk10   File: MethodElementHandler.java   View Source Code Vote up 6 votes
/**
 * Returns the result of method execution.
 *
 * @param type  the base class
 * @param args  the array of arguments
 * @return the value of this element
 * @throws Exception if calculation is failed
 */
@Override
protected ValueObject getValueObject(Class<?> type, Object[] args) throws Exception {
    Object bean = getContextBean();
    Class<?>[] types = getArgumentTypes(args);
    Method method = (type != null)
            ? MethodFinder.findStaticMethod(type, this.name, types)
            : MethodFinder.findMethod(bean.getClass(), this.name, types);

    if (method.isVarArgs()) {
        args = getArguments(args, method.getParameterTypes());
    }
    Object value = MethodUtil.invoke(method, bean, args);
    return method.getReturnType().equals(void.class)
            ? ValueObjectImpl.VOID
            : ValueObjectImpl.create(value);
}
 
Example 5
Project: lazycat   File: ExpressionBuilder.java   View Source Code Vote up 6 votes
@Override
public void visit(Node node) throws ELException {
	if (node instanceof AstFunction) {

		AstFunction funcNode = (AstFunction) node;

		if (this.fnMapper == null) {
			throw new ELException(MessageFactory.get("error.fnMapper.null"));
		}
		Method m = fnMapper.resolveFunction(funcNode.getPrefix(), funcNode.getLocalName());
		if (m == null) {
			throw new ELException(MessageFactory.get("error.fnMapper.method", funcNode.getOutputName()));
		}
		int methodParameterCount = m.getParameterTypes().length;
		int inputParameterCount = node.jjtGetNumChildren();
		if (m.isVarArgs() && inputParameterCount < methodParameterCount - 1
				|| !m.isVarArgs() && inputParameterCount != methodParameterCount) {
			throw new ELException(MessageFactory.get("error.fnMapper.paramcount", funcNode.getOutputName(),
					"" + methodParameterCount, "" + node.jjtGetNumChildren()));
		}
	} else if (node instanceof AstIdentifier && this.varMapper != null) {
		String variable = ((AstIdentifier) node).getImage();

		// simply capture it
		this.varMapper.resolveVariable(variable);
	}
}
 
Example 6
Project: lams   File: CacheAspectSupport.java   View Source Code Vote up 5 votes
private Object[] extractArgs(Method method, Object[] args) {
	if (!method.isVarArgs()) {
		return args;
	}
	Object[] varArgs = ObjectUtils.toObjectArray(args[args.length - 1]);
	Object[] combinedArgs = new Object[args.length - 1 + varArgs.length];
	System.arraycopy(args, 0, combinedArgs, 0, args.length - 1);
	System.arraycopy(varArgs, 0, combinedArgs, args.length - 1, varArgs.length);
	return combinedArgs;
}
 
Example 7
Project: lams   File: FunctionReference.java   View Source Code Vote up 5 votes
/**
 * Execute a function represented as a java.lang.reflect.Method.
 *
 * @param state the expression evaluation state
 * @param the java method to invoke
 * @return the return value of the invoked Java method
 * @throws EvaluationException if there is any problem invoking the method
 */
private TypedValue executeFunctionJLRMethod(ExpressionState state, Method method) throws EvaluationException {
	Object[] functionArgs = getArguments(state);

	if (!method.isVarArgs() && method.getParameterTypes().length != functionArgs.length) {
		throw new SpelEvaluationException(SpelMessage.INCORRECT_NUMBER_OF_ARGUMENTS_TO_FUNCTION,
				functionArgs.length, method.getParameterTypes().length);
	}
	// Only static methods can be called in this way
	if (!Modifier.isStatic(method.getModifiers())) {
		throw new SpelEvaluationException(getStartPosition(),
				SpelMessage.FUNCTION_MUST_BE_STATIC,
				method.getDeclaringClass().getName() + "." + method.getName(), this.name);
	}

	// Convert arguments if necessary and remap them for varargs if required
	if (functionArgs != null) {
		TypeConverter converter = state.getEvaluationContext().getTypeConverter();
		ReflectionHelper.convertAllArguments(converter, functionArgs, method);
	}
	if (method.isVarArgs()) {
		functionArgs = ReflectionHelper.setupArgumentsForVarargsInvocation(
				method.getParameterTypes(), functionArgs);
	}

	try {
		ReflectionUtils.makeAccessible(method);
		Object result = method.invoke(method.getClass(), functionArgs);
		return new TypedValue(result, new TypeDescriptor(new MethodParameter(method,-1)).narrow(result));
	}
	catch (Exception ex) {
		throw new SpelEvaluationException(getStartPosition(), ex, SpelMessage.EXCEPTION_DURING_FUNCTION_CALL,
				this.name, ex.getMessage());
	}
}
 
Example 8
Project: lams   File: ReflectiveMethodExecutor.java   View Source Code Vote up 5 votes
public ReflectiveMethodExecutor(Method method) {
	this.method = method;
	if (method.isVarArgs()) {
		Class<?>[] paramTypes = method.getParameterTypes();
		this.varargsPosition = paramTypes.length - 1;
	}
	else {
		this.varargsPosition = null;
	}
}
 
Example 9
Project: lazycat   File: AstFunction.java   View Source Code Vote up 5 votes
@Override
public Object getValue(EvaluationContext ctx) throws ELException {

	FunctionMapper fnMapper = ctx.getFunctionMapper();

	// quickly validate again for this request
	if (fnMapper == null) {
		throw new ELException(MessageFactory.get("error.fnMapper.null"));
	}
	Method m = fnMapper.resolveFunction(this.prefix, this.localName);
	if (m == null) {
		throw new ELException(MessageFactory.get("error.fnMapper.method", this.getOutputName()));
	}

	Class<?>[] paramTypes = m.getParameterTypes();
	Object[] params = null;
	Object result = null;
	int inputParameterCount = this.jjtGetNumChildren();
	int methodParameterCount = paramTypes.length;
	if (inputParameterCount == 0 && methodParameterCount == 1 && m.isVarArgs()) {
		params = new Object[] { null };
	} else if (inputParameterCount > 0) {
		params = new Object[methodParameterCount];
		try {
			for (int i = 0; i < methodParameterCount; i++) {
				if (m.isVarArgs() && i == methodParameterCount - 1) {
					if (inputParameterCount < methodParameterCount) {
						params[i] = new Object[] { null };
					} else if (inputParameterCount == methodParameterCount && paramTypes[i].isArray()) {
						params[i] = this.jjtGetChild(i).getValue(ctx);
					} else {
						Object[] varargs = new Object[inputParameterCount - methodParameterCount + 1];
						Class<?> target = paramTypes[i].getComponentType();
						for (int j = i; j < inputParameterCount; j++) {
							varargs[j - i] = this.jjtGetChild(j).getValue(ctx);
							varargs[j - i] = coerceToType(varargs[j - i], target);
						}
						params[i] = varargs;
					}
				} else {
					params[i] = this.jjtGetChild(i).getValue(ctx);
				}
				params[i] = coerceToType(params[i], paramTypes[i]);
			}
		} catch (ELException ele) {
			throw new ELException(MessageFactory.get("error.function", this.getOutputName()), ele);
		}
	}
	try {
		result = m.invoke(null, params);
	} catch (IllegalAccessException iae) {
		throw new ELException(MessageFactory.get("error.function", this.getOutputName()), iae);
	} catch (InvocationTargetException ite) {
		Throwable cause = ite.getCause();
		if (cause instanceof ThreadDeath) {
			throw (ThreadDeath) cause;
		}
		if (cause instanceof VirtualMachineError) {
			throw (VirtualMachineError) cause;
		}
		throw new ELException(MessageFactory.get("error.function", this.getOutputName()), cause);
	}
	return result;
}
 
Example 10
Project: incubator-netbeans   File: MethodInvocationContext.java   View Source Code Vote up 4 votes
public Method linkMethod(String methodName, Map<? extends String, ? extends ParameterKind> params) {
    Collection<Class<?>> paramTypes = new LinkedList<Class<?>>();

    for (Entry<? extends String, ? extends ParameterKind> e : params.entrySet()) {
        switch ((ParameterKind) e.getValue()) {
            case VARIABLE:
                paramTypes.add(Variable.class);
                break;
            case STRING_LITERAL:
                paramTypes.add(String.class);
                break;
            case ENUM_CONSTANT:
                Enum<?> constant = loadEnumConstant(e.getKey());

                paramTypes.add(constant.getDeclaringClass());
                break;
        }
    }

    Method varArgMethod = null;
    
    for (Class<?> clazz : ruleUtilities) {
        OUTER: for (Method m : clazz.getDeclaredMethods()) {
            if (methodName.equals(m.getName())) {
                Class<?>[] p = m.getParameterTypes();
                int c = 0;
                Iterator<Class<?>> it = paramTypes.iterator();

                for ( ; it.hasNext() && c < p.length; ) {
                    Class<?> paramClass = it.next();
                    Class<?> declaredClass = p[c++];

                    if (declaredClass.equals(paramClass))
                        continue;

                    if (   m.isVarArgs()
                        && declaredClass.isArray()
                        && declaredClass.getComponentType().equals(paramClass)
                        && c == p.length) {
                        while (it.hasNext()) {
                            if (!paramClass.equals(it.next())) {
                                continue OUTER;
                            }
                        }

                        break;
                    }

                    continue OUTER;
                }

                if (!it.hasNext() && c == p.length) {
                    if (!m.isVarArgs()) {
                        return m;
                    }
                    if (varArgMethod == null) {
                        varArgMethod = m;
                    }
                }
            }
        }
    }

    return varArgMethod;
}
 
Example 11
Project: elasticsearch_my   File: ESLoggerUsageTests.java   View Source Code Vote up 4 votes
public void testLoggerUsageCheckerCompatibilityWithLog4j2Logger() throws NoSuchMethodException {
    for (Method method : Logger.class.getMethods()) {
        if (ESLoggerUsageChecker.LOGGER_METHODS.contains(method.getName())) {
            assertThat(method.getParameterTypes().length, greaterThanOrEqualTo(1));
            int markerOffset = method.getParameterTypes()[0].equals(Marker.class) ? 1 : 0;
            int paramLength = method.getParameterTypes().length - markerOffset;
            if (method.isVarArgs()) {
                assertEquals(2, paramLength);
                assertEquals(String.class, method.getParameterTypes()[markerOffset]);
                assertThat(method.getParameterTypes()[markerOffset + 1], Matchers.<Class<?>>isOneOf(Object[].class, Supplier[].class));
            } else {
                assertThat(method.getParameterTypes()[markerOffset], Matchers.<Class<?>>isOneOf(Message.class, MessageSupplier.class,
                    CharSequence.class, Object.class, String.class, Supplier.class));

                if (paramLength == 2) {
                    assertThat(method.getParameterTypes()[markerOffset + 1], Matchers.<Class<?>>isOneOf(Throwable.class, Object.class));
                    if (method.getParameterTypes()[markerOffset + 1].equals(Object.class)) {
                        assertEquals(String.class, method.getParameterTypes()[markerOffset]);
                    }
                }
                if (paramLength > 2) {
                    assertEquals(String.class, method.getParameterTypes()[markerOffset]);
                    assertThat(paramLength, lessThanOrEqualTo(11));
                    for (int i = 1; i < paramLength; i++) {
                        assertEquals(Object.class, method.getParameterTypes()[markerOffset + i]);
                    }
                }
            }
        }
    }

    for (String methodName : ESLoggerUsageChecker.LOGGER_METHODS) {
        assertEquals(48, Stream.of(Logger.class.getMethods()).filter(m -> methodName.equals(m.getName())).count());
    }

    for (Constructor<?> constructor : ParameterizedMessage.class.getConstructors()) {
        assertThat(constructor.getParameterTypes().length, greaterThanOrEqualTo(2));
        assertEquals(String.class, constructor.getParameterTypes()[0]);
        assertThat(constructor.getParameterTypes()[1], Matchers.<Class<?>>isOneOf(String[].class, Object[].class, Object.class));

        if (constructor.getParameterTypes().length > 2) {
            assertEquals(3, constructor.getParameterTypes().length);
            if (constructor.getParameterTypes()[1].equals(Object.class)) {
                assertEquals(Object.class, constructor.getParameterTypes()[2]);
            } else {
                assertEquals(Throwable.class, constructor.getParameterTypes()[2]);
            }
        }
    }

    assertEquals(5, ParameterizedMessage.class.getConstructors().length);
}
 
Example 12
Project: tomcat7   File: AstValue.java   View Source Code Vote up 4 votes
private Object[] convertArgs(Object[] src, Method m) {
    Class<?>[] types = m.getParameterTypes();
    if (types.length == 0) {
        // Treated as if parameters have been provided so src is ignored
        return EMPTY_ARRAY;
    }
    
    int paramCount = types.length;

    if (m.isVarArgs() && paramCount > 1 && (src == null || paramCount > src.length) ||
            !m.isVarArgs() && (paramCount > 0 && src == null ||
                    src != null && src.length != paramCount)) {
        String srcCount = null;
        if (src != null) {
            srcCount = Integer.toString(src.length);
        }
        String msg;
        if (m.isVarArgs()) {
            msg = MessageFactory.get("error.invoke.tooFewParams",
                    m.getName(), srcCount, Integer.toString(paramCount));
        } else {
            msg = MessageFactory.get("error.invoke.wrongParams",
                    m.getName(), srcCount, Integer.toString(paramCount));
        }
        throw new IllegalArgumentException(msg);
    }

    if (src == null) {
        // Must be a varargs method with a single parameter.
        // Use a new array every time since the called code could modify the
        // contents of the array
        return new Object[1];
    }

    Object[] dest = new Object[paramCount];

    for (int i = 0; i < paramCount - 1; i++) {
        dest[i] = ELSupport.coerceToType(src[i], types[i]);
    }

    if (m.isVarArgs()) {
        Object[] varArgs = (Object[]) Array.newInstance(
                m.getParameterTypes()[paramCount - 1].getComponentType(),
                src.length - (paramCount - 1));
        for (int i = 0; i < src.length - (paramCount - 1); i ++) {
            varArgs[i] = ELSupport.coerceToType(src[paramCount - 1 + i],
                    types[paramCount - 1].getComponentType());
        }
        dest[paramCount - 1] = varArgs;
    } else {
        dest[paramCount - 1] = ELSupport.coerceToType(
                src[paramCount - 1], types[paramCount - 1]);
    }

    return dest;
}
 
Example 13
Project: OpenJSharp   File: JavaAdapterBytecodeGenerator.java   View Source Code Vote up 4 votes
private static int getAccessModifiers(final Method method) {
    return ACC_PUBLIC | (method.isVarArgs() ? ACC_VARARGS : 0);
}
 
Example 14
Project: apache-tomcat-7.0.73-with-comment   File: AstValue.java   View Source Code Vote up 4 votes
private Object[] convertArgs(Object[] src, Method m) {
    Class<?>[] types = m.getParameterTypes();
    if (types.length == 0) {
        // Treated as if parameters have been provided so src is ignored
        return EMPTY_ARRAY;
    }
    
    int paramCount = types.length;

    if (m.isVarArgs() && paramCount > 1 && (src == null || paramCount > src.length) ||
            !m.isVarArgs() && (paramCount > 0 && src == null ||
                    src != null && src.length != paramCount)) {
        String srcCount = null;
        if (src != null) {
            srcCount = Integer.toString(src.length);
        }
        String msg;
        if (m.isVarArgs()) {
            msg = MessageFactory.get("error.invoke.tooFewParams",
                    m.getName(), srcCount, Integer.toString(paramCount));
        } else {
            msg = MessageFactory.get("error.invoke.wrongParams",
                    m.getName(), srcCount, Integer.toString(paramCount));
        }
        throw new IllegalArgumentException(msg);
    }

    if (src == null) {
        // Must be a varargs method with a single parameter.
        // Use a new array every time since the called code could modify the
        // contents of the array
        return new Object[1];
    }

    Object[] dest = new Object[paramCount];

    for (int i = 0; i < paramCount - 1; i++) {
        dest[i] = ELSupport.coerceToType(src[i], types[i]);
    }

    if (m.isVarArgs()) {
        Object[] varArgs = (Object[]) Array.newInstance(
                m.getParameterTypes()[paramCount - 1].getComponentType(),
                src.length - (paramCount - 1));
        for (int i = 0; i < src.length - (paramCount - 1); i ++) {
            varArgs[i] = ELSupport.coerceToType(src[paramCount - 1 + i],
                    types[paramCount - 1].getComponentType());
        }
        dest[paramCount - 1] = varArgs;
    } else {
        dest[paramCount - 1] = ELSupport.coerceToType(
                src[paramCount - 1], types[paramCount - 1]);
    }

    return dest;
}
 
Example 15
Project: openjdk-jdk10   File: LoggerFinderAPITest.java   View Source Code Vote up 4 votes
/**
 * Tells whether a method invocation of 'origin' can be transformed in a
 * method invocation of 'target'.
 * This method only look at the parameter signatures, it doesn't look at
 * the name, nor does it look at the return types.
 * <p>
 * Example:
 * <ul>
 *     <li>java.util.logging.Logger.log(Level, String, Object) can be invoked as<br>
     java.util.logging.spi.Logger.log(Level, String, Object...) because the
     last parameter in 'target' is a varargs.</li>
 *     <li>java.util.logging.Logger.log(Level, String) can also be invoked as<br>
     java.util.logging.spi.Logger.log(Level, String, Object...) for the
     same reason.</li>
 * </ul>
 * <p>
 * The algorithm is tailored for our needs: when the last parameter in the
 * target is a vararg, and when origin & target have the same number of
 * parameters, then we consider that the types of the last parameter *must*
 * match.
 * <p>
 * Similarly - we do not consider that o(X x, Y y, Y y) matches t(X x, Y... y)
 * although strictly speaking, it should...
 *
 * @param origin The method in the original class
 * @param target The correspondent candidate in the target class
 * @return true if a method invocation of 'origin' can be transformed in a
 * method invocation of 'target'.
 */
public boolean canBeInvokedAs(Method origin, Method target,
                              Map<Class<?>,Class<?>> substitutes) {
    final Class<?>[] xParams = target.getParameterTypes();
    final Class<?>[] mParams = Stream.of(origin.getParameterTypes())
            .map((x) -> substitutes.getOrDefault(x, x))
            .collect(Collectors.toList()).toArray(new Class<?>[0]);
    if (Arrays.deepEquals(xParams, mParams)) return true;
    if (target.isVarArgs()) {
        if (xParams.length == mParams.length) {
            if (xParams[xParams.length-1].isArray()) {
                return mParams[mParams.length -1].equals(
                        xParams[xParams.length -1].getComponentType());
            }
        } else if (xParams.length == mParams.length + 1) {
            return Arrays.deepEquals(
                    Arrays.copyOfRange(xParams, 0, xParams.length-1), mParams);
        }
    }
    return false;
}
 
Example 16
Project: openjdk-jdk10   File: JavaAdapterBytecodeGenerator.java   View Source Code Vote up 4 votes
private static int getAccessModifiers(final Method method) {
    return ACC_PUBLIC | (method.isVarArgs() ? ACC_VARARGS : 0);
}
 
Example 17
Project: de.flapdoodle.solid   File: MethodResolver.java   View Source Code Vote up 4 votes
private static boolean parameterLengthMatches(Method m, MethodCacheKey key) {
	return m.isVarArgs() || m.getParameterTypes().length == key.arguments;
}
 
Example 18
Project: lazycat   File: AstValue.java   View Source Code Vote up 4 votes
private Object[] convertArgs(Object[] src, Method m) {
	Class<?>[] types = m.getParameterTypes();
	if (types.length == 0) {
		// Treated as if parameters have been provided so src is ignored
		return EMPTY_ARRAY;
	}

	int paramCount = types.length;

	if (m.isVarArgs() && paramCount > 1 && (src == null || paramCount > src.length)
			|| !m.isVarArgs() && (paramCount > 0 && src == null || src != null && src.length != paramCount)) {
		String srcCount = null;
		if (src != null) {
			srcCount = Integer.toString(src.length);
		}
		String msg;
		if (m.isVarArgs()) {
			msg = MessageFactory.get("error.invoke.tooFewParams", m.getName(), srcCount,
					Integer.toString(paramCount));
		} else {
			msg = MessageFactory.get("error.invoke.wrongParams", m.getName(), srcCount,
					Integer.toString(paramCount));
		}
		throw new IllegalArgumentException(msg);
	}

	if (src == null) {
		// Must be a varargs method with a single parameter.
		// Use a new array every time since the called code could modify the
		// contents of the array
		return new Object[1];
	}

	Object[] dest = new Object[paramCount];

	for (int i = 0; i < paramCount - 1; i++) {
		dest[i] = ELSupport.coerceToType(src[i], types[i]);
	}

	if (m.isVarArgs()) {
		Object[] varArgs = (Object[]) Array.newInstance(m.getParameterTypes()[paramCount - 1].getComponentType(),
				src.length - (paramCount - 1));
		for (int i = 0; i < src.length - (paramCount - 1); i++) {
			varArgs[i] = ELSupport.coerceToType(src[paramCount - 1 + i], types[paramCount - 1].getComponentType());
		}
		dest[paramCount - 1] = varArgs;
	} else {
		dest[paramCount - 1] = ELSupport.coerceToType(src[paramCount - 1], types[paramCount - 1]);
	}

	return dest;
}