Hello,
I have a method that looks like this on Java:
public void myMethod(Object... parms);
But I can't call this method as expected from the scripts.
If, in ruby, I do:
$myObject.myMethod(42);
It gives me org.jruby.exceptions.RaiseException: could not coerce Fixnum to class [Ljava.lang.Object
If I try the following in Javascript:
myObject.myMethod(42);
Then it gives me sun.org.mozilla.javascript.internal.EvaluatorException: Can't find method MyClass.test(number). (#2) in at line number 2
Of course, if I change the signature to take one single object then it works.
I assume that this is because someone along the line does not know how to convert, say Integer
to Integer[]
with the value at the first position.
I believe something like myMethod({42, 2009})
would work in Ruby, but this seems ugly - I wanted to be able to just do myMethod(42, 2009)
to make it less confusing, specially for other languages. Is there any better workaround for this?
Thanks.