First draft of translation document - contravariance
Rémi Forax
forax at univ-mlv.fr
Tue May 18 17:37:00 PDT 2010
Le 19/05/2010 02:32, Reinier Zwitserloot a écrit :
> Now I'm a bit confused. That sounds like this:
>
> #void(Integer) vi = #void(Integer i) { };
> #void(String) vs = vi;
>
> would be legal as well which should be wrong, no?
>
> --Reinier Zwitserloot
It's not legal,
MethodHandle are runtime time not compiler one.
List<String> is erased to List,
#void(String) is erased to MethodHandle
like List<String> and List<Integer> aren't compatible,
#void(String) and #void(Integer) aren't compatible too.
cheers,
Rémi
>
>
>
> On Tue, May 18, 2010 at 11:10 AM, Rémi Forax <forax at univ-mlv.fr
> <mailto:forax at univ-mlv.fr>> wrote:
>
> Le 18/05/2010 11:01, Howard Lovatt a écrit :
> > I am guessing that the following will fail with the suggested
> > MethodHandle translation (it is hard to say from the JSR292
> > literature):
> >
> > #String(Object) so = #String(final Object o) (o.toString());
> > #Object(String) os = so;
> >
> > Assuming it does fail, this failure may not be important since
> the use
> > case is rare. Therefore this is post is a request for clarification
> > rather than a criticism.
> >
> > -- Howard.
> >
> >
>
> #String(Object) and #Object(String) will be erased to
> java.dyn.MethodHandle
> so it doesn't fail.
>
> BTW, jdk7 beta binaries already contain a preview of JSR 292 API,
> this is not the final API and there are some known bugs
> but you can already play with it.
>
> cheers,
> Rémi
>
>
>
>
>
More information about the lambda-dev
mailing list