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.getMethod() which means finding put(Object, Object) is
not possible when having something else.


So it would be nice if we could write this algorithm once and for all
and make it public somewhere :-)


This may be a nice idea at first but for the XMLDecoder one special requirement spoils it. The XML
data knows no primitives but wraps them always in their respective class. When testing whether a given argument
type T can be assigned to a method's parameter type P I have to do something like this:


if (P.isAssignableFrom(T)) -> good one, check next parameter
else if(T.isPrimitiveWrapperClass() && P.isAssignableFrom(getPrimitiveTypeFor(T)) --> good one, check next parameter
else -> bail out, method signature is unsuitable


This is what it makes IMHO incompatible with a general solution. :-(

cu
Robert


_______________________________________________ Classpath mailing list [EMAIL PROTECTED] http://lists.gnu.org/mailman/listinfo/classpath

Reply via email to