JDK 8 code review request for 7140820 Add covariant overrides to Collections clone methods

Joe Darcy joe.darcy at oracle.com
Mon Jan 30 05:44:25 UTC 2012


Hi David,

On 01/29/2012 09:18 PM, David Holmes wrote:
> Hi Joe,
>
> This looks okay to me.
>
> I guess we don't have any tests for that code in EventRequestSpecList!

Guess not!

>
> Pity about the constant need for suppressing  "unchecked" :(


At least better once per type in the libraries rather than than once at 
every call-site.

The clone method would be a good use-case for self types, but adding 
those to Java remains a research-class problem.

Thanks for the review,

-Joe

>
> Cheers,
> David
>
> On 30/01/2012 1:58 PM, Joe Darcy wrote:
>> Hello,
>>
>> As an indirect outgrowth of warnings cleanup day, various categories of
>> warnings can be eliminated by in the use of Cloneable types by
>> overriding the
>>
>> Object clone()
>>
>> method inherited from java.lang.Object with a covariant override such as
>>
>> MyType clone()
>>
>> Please review my changes for
>>
>> 7140820 Add covariant overrides to Collections clone methods
>> http://cr.openjdk.java.net/~darcy/7140820.0/
>>
>> which add such covariant override clone methods to collections and a few
>> other classes in java.util. Doing a full JDK build with these changes,
>> I've also made alterations to other classes to remove now superfuous
>> casts (casts which are a javac lint warning!) and some unneeded
>> @SuppressWarnings annotations. I also cleaned up a few rawtypes warnings
>> while in editing files in java.util.
>>
>> (Note that the old specListeners method in EventRequestSpecList.java was
>> much buggy; it cast an ArrayList from runtime.specListeners to a 
>> Vector.)
>>
>> Thanks,
>>
>> -Joe




More information about the core-libs-dev mailing list