Lambda Conversion Considered Harmful?

Joshua Bloch jjb at google.com
Fri Feb 19 16:13:03 PST 2010


Neal,

On Fri, Feb 19, 2010 at 3:56 PM, Neal Gafter <neal at gafter.com> wrote:

> On Fri, Feb 19, 2010 at 3:36 PM, Joshua Bloch <jjb at google.com> wrote:
>
>> Just to echo Alex's concerns, I was fooled by this, hence my statement
>> that
>> it was converting from one interface to another. JLS 3 (Section
>> 5.1.5)<
>> http://java.sun.com/docs/books/jls/third_edition/html/conversions.html
>> >says
>>
>> "
>> A *widening reference* conversion exists from any type *S* to any type
>> *T*,
>> provided *S* is a subtype
>> (§4.10)<
>> http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#120403
>> >
>>
>>  of *T*."  The lambda conversion described in CfJ does not meet this
>> specification, so it's wrong to call it a widening reference conversion.
>>
>
> This is clearly a bug in the JLS, otherwise the widening conversion from
> byte to int would be a widening reference conversion.
>
>
I'd argue that the bug is that byte is defined to be a subtype of int.  This
wasn't true in earlier editions of the JLS, as I recall;)

                 Josh


More information about the lambda-dev mailing list