Collections.enumeration() WAS Warning Cleanup Day

David Holmes david.holmes at oracle.com
Sun Dec 4 17:39:37 PST 2011


On 4/12/2011 5:37 AM, Rémi Forax wrote:
> On 12/03/2011 05:21 PM, Mike Duigou wrote:
>> On Dec 3 2011, at 07:12 , Rémi Forax wrote:
>>
>>> On 12/03/2011 03:33 PM, Alan Bateman wrote:
>>>> On 03/12/2011 12:37, Rémi Forax wrote:
>>>>> I've started to remove warnings from java.util
>>>>> and I'm not able to cleanly retrofit java.util.PropertyPermission
>>>>> because java.util.Collections.enumeration is wrongly typed.
>>>>>
>>>> Rémi - you might want to sync up with Mike Duigou as I believe he
>>>> has been working on the java.util area including collections. Also
>>>> best to move any discussions on collections/util area to
>>>> core-libs-dev too.
>>>>
>>>> -Alan
>>> too late :)
>>>
>>> Here is a webrev that remove most of the unchecked cast/raw generics
>>> warnings
>>> http://cr.openjdk.java.net/~forax/WarningDay1/webrev/
>>>
>>> Rémi
>>>
>> I have changes in about 15 files. I will compare them against yours. I
>> actually believe that doing the same work independently and then
>> comparing the results is a stronger validation than inspection review.
>
> yes.
>
>>
>> Thanks for submitting these fixes.
>>
>> Mike
>
> Mike, there is a raw type I was not able to remove in Collections line
> 1408,
> I understand the problem but was not able to come with a solution.
> The current fix is not good because it equivalent to say f*** you
> wildcards !

So the obvious fix is:

   @SuppressWarnings({ "unchecked" })
   UnmodifiableEntrySet(Set<? extends Map.Entry<? extends K, ? extends 
V>> s) {
     super((Set<? extends Map.Entry<K,V>>)s);
   }

Why doesn't it work?

David


More information about the jdk8-dev mailing list