Boxing, still a limit of invokedynamic?

Jochen Theodorou blackdrag at gmx.org
Sun May 13 13:21:18 PDT 2012


Am 13.05.2012 19:55, schrieb Rémi Forax:
[...]
> I think currently Groovy allows to replace + by a method
> that will return everything you want.
> But here, I think the spec of Groovy (if it means something)
> should be changed to say that when your replace a method
> by another, the return type must be a subtype of the
> existing method.

that helps if the argument types are known and there is an exact match 
to a method. It helps because in that case we can save the casting and 
converting plus the checks to see if we even have to do that. Yes. But 
currently that is not the case. And it won't change for Groovy2, maybe 
for a later Groovy.

[...]
> Object ->  int is not equivalent to Object ->  Integer ->  int,
> it can be Object ->  Byte ->  int by example.
> You have to chain several calls to asType()
>
> see slide 20 of my jvm summit talk last year,
> http://wiki.jvmlangsummit.com/images/9/93/2011_Forax.pdf

so you mean to tell me that I have first to convert the Object to an 
Integer and that Integer to int, instead of directly converting the 
Object to an int? I see, I will try that out.

bye Jochen



More information about the mlvm-dev mailing list