Lightweight interfaces instead of function types

Rémi Forax forax at univ-mlv.fr
Sun Feb 21 03:58:50 PST 2010


Le 21/02/2010 08:37, Neal Gafter a écrit :
> On Fri, Feb 19, 2010 at 10:15 AM, Stephen Colebourne
> <scolebourne at joda.org>wrote:
>
>    
>> On 19 February 2010 17:47, Neal Gafter<neal at gafter.com>  wrote:
>>      
>>> Tmp.java:5: [error] generic array creation
>>>         Callable<String>[] array = new Callable<String>[10];
>>> This is a hard error, not a warning.
>>>        
>> True. But if I want a Callable<String>[] I write:
>>
>>       Callable<String>[] array = new Callable[10];
>>
>> This works, and is safe /in practice/ (rather than type-system safe).
>>
>>      
> It is because people like you have been teaching this "safe in practice"
> attitude that people write code like that... code that would break hard if
> generics were ever reified.  The existence of so much code that would break
> is a principal obstacle to actually reifying generics.
>    

It's not safe ?
it raises a warning.

Rémi


More information about the lambda-dev mailing list