Re: finding method efficiently

2004-09-28 Thread Artur Biesiadowski
Archie Cobbs wrote: I have come across this same challenge several times now, i.e., having to write code that implements the Java "best match" semantics for method invocation using reflection. Usually I end up doing something that works in all the 'easy' cases and punt on the rest. [...] So it wou

Re: finding method efficiently

2004-09-28 Thread Robert Schuster
Thanks for all the replies. I have rewritten the code that searches the methods using isAssignableFrom() (and feeling much better about it now). Archie Cobbs wrote: For an almost-example, look at Classpath's java.lang.Class.internalGetMethod(). Unfortunately it works exactly like Class.getMeth

Re: finding method efficiently

2004-09-28 Thread Tom Tromey
> "Archie" == Archie Cobbs <[EMAIL PROTECTED]> writes: Archie> So it would be nice if we could write this algorithm once and Archie> for all and make it public somewhere :-) Sounds good to me. It could take a Method[] and a Class[] representing the arguments, and return the maximally specifi

Re: finding method efficiently

2004-09-28 Thread Archie Cobbs
David Holmes wrote: > Regardless this is not something I would want to hand code using the > reflection API as Robert must do. I have come across this same challenge several times now, i.e., having to write code that implements the Java "best match" semantics for method invocation using reflection

RE: finding method efficiently

2004-09-27 Thread David Holmes
Tom Tromey writes: > Yeah, I agree, based on what I read it does seem that way. > This algorithm is going through an overhaul as a result of all the > new language features, I wonder if that will propagate to > XMLDecoder. At least the algorithm has been overhauled such that the new features do no

Re: finding method efficiently

2004-09-27 Thread Tom Tromey
> "David" == David Holmes <[EMAIL PROTECTED]> writes: David> Hmmm. There is a further problem that you have to work out how David> to do this such that overload resolution is applied David> correctly. Basically I can't see any way to do this other than David> to reapply the same method resolut

RE: finding method efficiently

2004-09-27 Thread David Holmes
> Tom Tromey writes > > "Robert" == Robert Schuster <[EMAIL PROTECTED]> writes: > > Robert> Now when evaluating the XML data I have to search the method "put" > Robert> which accepts the two arguments. Having > Robert> only String and JFrame as argument types means that the call to > Robert>

Re: finding method efficiently

2004-09-27 Thread Tom Tromey
> "Robert" == Robert Schuster <[EMAIL PROTECTED]> writes: Robert> Now when evaluating the XML data I have to search the method "put" Robert> which accepts the two arguments. Having Robert> only String and JFrame as argument types means that the call to Robert> HashMap.class.getMethod("put

finding method efficiently

2004-09-27 Thread Robert Schuster
Hi Classpath hackers, I am currently implementing java.beans.XMLDecoder which now starts to work. But I have a small (efficiency) problem. As you might know the decoder accepts XML data like this: 12 43 and executes this using reflection as if I had written: new Point(12, 43). Now somethi