Lightweight interfaces instead of function types
Neal Gafter
neal at gafter.com
Sat Feb 20 23:37:55 PST 2010
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.
More information about the lambda-dev
mailing list