Jochen Theodorou a écrit : > Rémi Forax schrieb: > >> Jochen Theodorou a écrit : >> >>> Rémi Forax schrieb: >>> [...] >>> >>> >>>>> As you said the type of the target method handle embeds the receiver type, >>>>> and as john said the type of the site doesn't include the receiver type. >>>>> >>>>> I don't like that mismatch, because it's confusing >>>>> >>>>> >>>> I know now why the receiver type is not available. >>>> because invokedynamic is an invokeinterface with java/dyn/Dynamic as >>>> receiver, >>>> the receiver is lost. So in my opinion callsite.type().parameters(0) >>>> should be always java/lang/Object. >>>> >>>> >>> if this is true... shouldn't then it be removed? I mean why having a >>> value here if the value is always and ever the same. >>> >>> >> Because you have to check the method handle signature when setTarget() >> is called. >> The easy way to do that is to check that target.type() is equals (using >> ==) to >> classSite.type(). >> > > hmm... I do not see anything easy in that. target is my MethodHandle, > which I got for example from reflection. That means there is a big > chance that target.type().parameters(0) will not be java.lang.Object. > And unless I wrap my MethodHandle just for the return type I see no way > of changing that.... MethodHandles.convertArguments is what you looking for. > and for wrapping I would need something defined on > Object with the same parameter types? that would sound like a big > mismatch in the design. > > No.. I think that for example Object#toString() has no parameters, so a > parameters(0) does not exist and can't be Object, > target.parameterCount()==0. > > Then there is also no problem with using equals. > > bye Jochen > > Rémi
--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "JVM Languages" group. To post to this group, send email to jvm-languages@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/jvm-languages?hl=en -~----------~----~----~----~------~----~------~--~---