Notes on implementing concise calls to constructors with type parameters
Maurizio Cimadamore
Maurizio.Cimadamore at Sun.COM
Thu May 14 04:28:36 PDT 2009
>
> Yes, assuming the "diamond" construct is only to be used on the
> right-hand-side of an assignment. But I think it's wrong to make
> language constructs non-orthogonal.
It seems to me that the "diamond" construct has always had this
restricted-ness right from the beginning. See the original draft:
http://mail.openjdk.java.net/pipermail/coin-dev/2009-February/000009.html
Btw - allowing inference in method invocation context is rather complex
- a slight variation of your example fails to compile with both
approaches; given the following method declaration:*
void f(List<String> xs) ...*
the following method call
*f(new ArrayList<>())*
won't type-check. I'm not saying that the algorithm doesn't exist, but
it seems way too far from what the original draft looked like. The
bottom-line is: if we just consider inference in assignment context (and
I think we should - at least if we want to keep this change 'small' ;-)
), there's no substantial difference between my proposal and yours.
cheers
Maurizio
More information about the coin-dev
mailing list