Review Request: 7193406 - Clean-up JDK Build Warnings in java.util, java.io

Joe Darcy joe.darcy at oracle.com
Wed Aug 29 08:27:21 PDT 2012


Hello,

On 8/29/2012 1:48 AM, Rémi Forax wrote:
> On 08/29/2012 08:33 AM, Kurchi Subhra Hazra wrote:
>> Thanks for cleaning up those spaces Dan. The changes look fine.
>> Sorry for the extra trouble!
>>
>> - Kurchi
>>
>> On 8/28/12 10:22 PM, Dan Xu wrote:
>>> It is funny. :) I have searched all source codes under jdk and 
>>> removed spaces for the similar cases.
>>>
>>> Please review the new version of change at, 
>>> http://cr.openjdk.java.net/~dxu/7193406/webrev.03/.
>>>
>>> Thanks for your comment!
>>>
>>> -Dan
>
> Hi Dan,
>
> In PreHashedMap, the code should be
>
>   Map.Entry<?,?> that = (Map.Entry<?,?>)ob;
>
> so the @SuppressWarnings is not needed anymore.
>
> And in java.util.Arrays, asList() should not be annotated with 
> @SuppressWarnings because it is already annotated with SafeVarargs, so 
> the compiler should not report the varargs warning.
>
> I have CC to compiler-dev to be sure that this is a compiler error.
>
> cheers,
> Rémi
>

I've spoken to Stuart about this last point.  The @SafeVarargs covers 
uses of Array.asList and covers the declaration of the asList method 
itself.  However, it does not cover calls to the constructor inside the 
asList method, a constructor which itself is *not* @SafeVarargs.  
Solutions include

* @SuppressWarnings("varargs") on the asList method
* @SuppressWarnings("varargs")  on new temporary variable for that 
purpose (with possible class file size consequences)
* @SafeVarargs on the ArrayList constructor

Regards,

-Joe



More information about the compiler-dev mailing list