Diamond and Generic Methods
Paul Benedict
pbenedict at apache.org
Thu May 5 12:08:22 PDT 2011
On Thu, May 5, 2011 at 2:04 PM, Dan Smith <daniel.smith at oracle.com> wrote:
> Taking a stab at it, I think you're saying inference chooses 'T' as the type argument for 'new ArrayList<>' (or has "the appearance" of choosing 'T').
I think you understand my concern for the most part. I was just
expressing my opinion that I think most people would read this:
identity(new java.util.ArrayList<>());
..as a shorthand for..
identity(new java.util.ArrayList<T>());
... and not make the mental leap that they are really doing:
identity(new java.util.ArrayList<Object>());
Diamond's inference is being sold as a shortcut.. so we may find out
it exposes mental shortcuts too :-)
Paul
More information about the coin-dev
mailing list