Contexts for target typing - Array initializers

maurizio cimadamore maurizio.cimadamore at oracle.com
Sat Aug 4 02:03:59 PDT 2012


On 04-Aug-12 7:27 AM, Deepak S Patwardhan wrote:
> Hello,
>
> State of lambda, v4, Section 5 gives the following example for lambda
> expressions inside array initializers.
> runAll(new Callable<String>[]{ ()->"a", ()->"b", ()->"c" });
>
> It doesn't work because Java does not allow creation of an array of a
> generic type.
>
> We can instantiate the raw type (works with build 50)
> runAll(new Callable[] { () -> "a", () -> 'b', () -> 99 });
>
> So, the original example is never supposed to work, right? (unless or until
> Java allows creation of arrays of generic type)
The example is bogus - support for generic arrays is clearly out of 
scope of Project Lambda ;-)

Maurizio
>
> regards,
> Deepak S Patwardhan.
>
>



More information about the lambda-dev mailing list