Problem with lambda expression
maurizio cimadamore
maurizio.cimadamore at oracle.com
Sun Aug 22 10:42:06 PDT 2010
Hi Howard
thanks for playing with the prototype. Could you please post the fulle
body of the interface containing the exrension method? it seems like it
should be something like:
interface MyIntf<T> {
...
}
and that, possibly, your 'il' variable is something like MyIntf<Long> ?
If it is so, it seems like a bug with type-inference for plain
'expression' lambdas - should be easily fixable.
Thanks
Maurizio
On 22/08/2010 05:58, Howard Lovatt wrote:
> For the extension method:
>
> <throws E> extension void forEach( Method1<T, T, E> method ) throws
> E default Trait.forEach;
>
> Called with:
>
> il.forEach( #( i ) { 2 * i } ); // No exception, no try block
>
> Gives:
>
> lambdas/Main.java:30: integer number too large: i
> il.forEach( #( i ) { 2 * i } ); // No exception, no try block
> ^
> (The arrow points to the 2 in a mon-spaced font.) Whereas:
>
> il.forEach( #( i ) { return 2 * i; } ); // No exception, no try block
>
> Works as expected.
>
> -- Howard.
>
>
More information about the lambda-dev
mailing list