protected void forceNumberArgumentsToParameterTypes( Object[] args, Class[] paramTypes, int[] typeFlagsByParamIndex) { final int paramTypesLen = paramTypes.length; final int argsLen = args.length; for (int argIdx = 0; argIdx < argsLen; argIdx++) { final int paramTypeIdx = argIdx < paramTypesLen ? argIdx : paramTypesLen - 1; final int typeFlags = typeFlagsByParamIndex[paramTypeIdx]; // Forcing the number type can only be interesting if there are numerical parameter types on // that index, // and the unwrapping was not to an exact numerical type. if ((typeFlags & TypeFlags.WIDENED_NUMERICAL_UNWRAPPING_HINT) != 0) { final Object arg = args[argIdx]; // If arg isn't a number, we can't do any conversions anyway, regardless of the param type. if (arg instanceof Number) { final Class targetType = paramTypes[paramTypeIdx]; final Number convertedArg = BeansWrapper.forceUnwrappedNumberToType((Number) arg, targetType, bugfixed); if (convertedArg != null) { args[argIdx] = convertedArg; } } } } }