mardi 15 août 2017

invoke throws IllegalArgumentException: wrong number of arguments

I know there have been a lot of questions about Reflexion. I have read every one of them but the answer to my problem doesn't come up

Here I have the following code

Method fn = Class.forName("paramopt.ParamOpt")
                 .getDeclaredMethod("Fn", double[].class);

Method Fn(double[] x) is a function declared on ParamOpt Class as public static. It is invoked this way

 y[n] = (double) fn.invoke(new Object[]{start});

where start is a double[4] array. And there is where I get

IllegalArgumentException: wrong number of arguments message.

Any ideas?





Aucun commentaire:

Enregistrer un commentaire