LJC Lambdas Hackday

Rémi Forax forax at univ-mlv.fr
Tue Jun 5 00:43:47 PDT 2012


On 06/05/2012 09:27 AM, Martijn Verburg wrote:
> Hi David,
>
>> Type inference only happens at compile time, and once types are inferred,
>> the usual static type checking takes place. At run time, all the usual type
>> safety is there.
>>
>> At least, that is my understanding.
>>
>> If you really want to make Java safer, pressure them to reify generics and
>> get rid of that awful co- (or is it contra-?) variance on arrays. :)
> On the co/contra variance arrays point, Janina and Raoul from
> Cambridge Uni did some empirical research on this and discovered that
> the usage of these types of arrays is statistically irrelevant.  You
> can see their article about this here:
> http://www.oraclejavamagazine-digital.com/javamagazine/20120506?pg=45#pg45
>
> Cheers,
> Martijn
>

yes, the question is simple, how many often your application
throws an ArrayStoreException.
My answer is never.

So if we reified generics, the best is to do a runtime check
when a method of a parametrized class takes an E
as parameter and get ride of wildcards.

Rémi



More information about the lambda-dev mailing list