static boolean doesParameterTypesMatchForVarArgsInvocation ( boolean isVarArgs , Class < ? > [ ] parameterTypes , Object [ ] arguments ) { if ( isVarArgs && arguments != null && arguments . length >= 1 && parameterTypes != null && parameterTypes . length >= 1 ) { final Class < ? > componentType = parameterTypes [ parameterTypes . length - 1 ] . getComponentType ( ) ; final Object lastArgument = arguments [ arguments . length - 1 ] ; if ( lastArgument != null ) { final Class < ? > lastArgumentTypeAsPrimitive = getTypeAsPrimitiveIfWrapped ( lastArgument ) ; final Class < ? > varArgsParameterTypeAsPrimitive = getTypeAsPrimitiveIfWrapped ( componentType ) ; isVarArgs = varArgsParameterTypeAsPrimitive . isAssignableFrom ( lastArgumentTypeAsPrimitive ) ; } } return isVarArgs && checkArgumentTypesMatchParameterTypes ( isVarArgs , parameterTypes , arguments ) ; }
Does parameter types match for var args invocation .