function types syntax
Osvaldo Pinali Doederlein
opinali at gmail.com
Wed Jan 6 15:32:04 PST 2010
Em 06/01/2010 19:57, Alex Buckley escreveu:
> Osvaldo Doederlein wrote:
>
>> You mean, like we fixed the 5% of important generics issues (e.g.
>> warning-free new X<T>[]) in JDK 6? Oh, no we didn't; like we are fixing them
>> now in JDK 7? Nope... perhaps in JDK 8? Some release before I retire?...
>>
> new X<T>[] gives a warning because X<T> is not a reifiable type (JLS3
> 4.7) unless T is an unbounded wildcard, which I'll assume it isn't. The
> warning is therefore necessary to indicate possible heap pollution (JLS3
> 4.12.2.1). The warning can only be removed if the possibility of heap
> pollution is removed, which in turn requires reified generics (which
> really just moves the problem) or an astoundingly clever dataflow
> analysis. So as irritating as the warnings are, the fix is not a minor
> last-5%-of-the-work tidying-up issue.
>
I'm aware of these issues and with the 5% I didn't mean the solution was
simple. But if the problem (and others - confusion with wildcards, no
unboxed generics over primitive types etc.) is hard to solve, perhaps we
should have planned to do as much as possible in each release, or at
least in each release that opens doors for language changes. At least in
JDK 7, the priority for fixing/enhancing generics was zero; the diamond
operator is clearly only included because it's a (relatively) very
simple, low hanging fruit. So, I tend to be in the side of either do the
complete job in a single release, or have up-front planning for
incremental improvements as soon as possible.
A+
Osvaldo
More information about the lambda-dev
mailing list