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

Joe Darcy joe.darcy at
Wed Aug 29 15:27:21 UTC 2012


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, 
>>> 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



More information about the core-libs-dev mailing list