Method argument inference?

Adam Rabung adamrabung at gmail.com
Mon Sep 28 07:12:13 PDT 2009


In systems I've worked on, this lack of inference seems to cause more
"noise" than even the lack of collection literals.

On Tue, Sep 22, 2009 at 12:52 AM, Joe Darcy <Joe.Darcy at sun.com> wrote:
> On 09/20/09 09:58 PM, Florian Weimer wrote:
>> * John Hendrikx:
>>
>>
>>> This gets flagged as a warning by the compiler, as it cannot infer the
>>> type from the method parameters.  The code below is warning free however
>>> with an unnecessary intermediate assignment:
>>>
>>>   Set<String> emptySet = Collections.emptySet();
>>>   dealWithStringSet(emptySet);
>>>
>>
>> FWIW, you can also use:
>>
>>     dealWithStringSet(Collections.<Set<String>>emptySet());
>>
>>
>
> That should be
>
>        dealWithStringSet(Collections.<String>emptySet());
>
> -Joe
>
>



More information about the coin-dev mailing list