hg: lambda/lambda/langtools: Bug fixes

Ali Ebrahimi ali.ebrahimi1781 at gmail.com
Mon Sep 6 21:20:55 PDT 2010


Hi Maurizio,
Comments inlined.

On Sat, Sep 4, 2010 at 8:02 PM, maurizio cimadamore <
maurizio.cimadamore at oracle.com> wrote:

>  On 04/09/2010 07:21, Ali Ebrahimi wrote:
>
>> Hi Maurizio,
>> In Howard's sample code:
>>
>> il.forEach( #( notUsed ) { 0 } ); // OK
>>
>> il.forEach( #( notUsed ) { return 0; } ); // OK
>>
>> il.forEach( #( notUsed ) {  } ); // OK
>>
>>
>> But:
>>
>> il.forEach( #( notUsed ) { return notUsed + 0; } ); // Need to catch
>> the checked exception!
>>
>> il.forEach( #( notUsed ) { notUsed + 0; } ); // Need to catch the
>> checked exception!
>>
> Hi Ali
> these are ok (well, they can be improved, but the result is somewhat
> expected).
>
> I don't agree. I think inference of parameters at least in such
cases should not affect inference of  thrown checked exceptions.

And

il.forEach( #( notUsed ) { return notUsed + 0; } ); // Need to catch
the checked exception!

il.forEach( #( notUsed ) { notUsed + 0; } ); // Need to catch the
checked exception!

treats as

il.forEach( #( Integer used ) { return used + 0; } ); //No Need to catch
the checked exception!

il.forEach( #( Integer used ) { used + 0 } ); // No Need to catch the
checked exception!

since parameters can be inferred by target typing No need to explicit
typing.

 il.forEach( #( notUsed ) { int j=0; return 0; } ); // Need to catch
>> the checked exception!
>>
>
> This is weird, as the untyped parameter is not even used in the lambda body
> - in this case the inferencer should be able to determine that no exception
> is thrown by the lambda body... I will look into that...
>
> Thanks
> Maurizio
>
>>
>> Best Regards,
>>
>> Ali Ebrahimi
>>
>>
>


More information about the lambda-dev mailing list