> However the Java 2 Platform Standard Ed. 5.0 javadoc for Method shows
> the following signature for invoke
>
> Object invoke(Object obj, Object... args)
> try {
> m.invoke(null);
[quoted text clipped - 4 lines]
> aforementioned code ... surely the compiler should flag this as a
> compile time error. Obviously I'm missing something but I can't see what.
The second argument is a varargs argument, which is translated to an
array automatically by the compiler. If omitted, the varargs argument
is populated with an empty array.
-Owen
lyallex - 29 Sep 2007 12:17 GMT
>> However the Java 2 Platform Standard Ed. 5.0 javadoc for Method shows
>> the following signature for invoke
[quoted text clipped - 11 lines]
>
> The second argument is a varargs argument,
Oh ******, and I thought I had got a handle on all the new 1.5 features.
Thanks for that
Duncan
Mike Schilling - 29 Sep 2007 19:33 GMT
>>> However the Java 2 Platform Standard Ed. 5.0 javadoc for Method
>>> shows the following signature for invoke
[quoted text clipped - 15 lines]
> Oh ******, and I thought I had got a handle on all the new 1.5
> features.
The ones that were introduced to make your life easier? :-)
lyallex - 29 Sep 2007 20:33 GMT
>>>> However the Java 2 Platform Standard Ed. 5.0 javadoc for Method
>>>> shows the following signature for invoke
[quoted text clipped - 3 lines]
>
> The ones that were introduced to make your life easier? :-)
:-) Yea, they're the ones. Sometimes I think that some of these
'enhancements' are only invented to give anal interviewers something to
pick up on to make themselves feel superior when they are interviewing
you for some squalid little job in some ghastly sweatshop.
Never give up, never surrender.
Galaxy Quest, the best film EVER ;-)
>Object invoke(Object obj, Object... args)
>
[quoted text clipped - 7 lines]
>I have looked at the code for Method and there is only one 2 arg method
>called invoke.
I had to read your post several time to figure out why you thought
that code should not work.
Object ... arg --- the parm list can also be empty (unlike the ...
ellipsis in English). This effectively gives you a 1-arg constructor.

Signature
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
lyallex - 29 Sep 2007 14:52 GMT
>> Object invoke(Object obj, Object... args)
>>
[quoted text clipped - 10 lines]
> I had to read your post several time to figure out why you thought
> that code should not work.
Really, I thought I'd made it quite clear, oh well, it's all sorted now.