Code Review Request: 7090158 Networking Libraries don't build with javac -Werror
Weijun Wang
weijun.wang at oracle.com
Wed Sep 14 18:51:35 PDT 2011
>>>
>>> 234 l = new ArrayList<>();
>>>
>>> Do we have a consensus on whether diamond can be used here? i.e.
>>> assignment not on declaration.
>
> Waiting for someone's input on this. In retrospect, I feel this is not
> exactly how the diamond operator is meant to be used when I refer to
> http://download.oracle.com/javase/7/docs/technotes/guides/language/type-inference-generic-instance-creation.html,
> although this particular situation has not been commented upon.
Some time ago when Stuart applied diamond to all TL codes, I remember we
agreed on several rules:
If the declaration and assignment are on one line, we use diamond, say
Map<String> map = new HashMap<>();
If not, we don't, so that people needn't go back to the declaration line
to find out what the parameters are, say
Map<String> map;
....
map = new HashMap<String>();
So this is mainly a coding-style thing.
-Max
>
>
> Thanks,
> Kurchi
More information about the net-dev
mailing list