Please Review: 6984084 (str) n times repetition of character constructor for java.lang.String

David Holmes david.holmes at oracle.com
Thu Aug 23 00:35:44 UTC 2012


On 22/08/2012 11:52 AM, David Holmes wrote:
> StringBuilder.java
>
> /**
> + * @throws IllegalArgumentException if n < 0 {@inheritDoc}
>
> This is wrong as you've already written the inherited doc "if n < 0".
>
> + * @since 1.8
> + */
> + public StringBuilder append(int n, CharSequence cs) {
> + super.append(n, cs);
> + return this;
> + }
>
> But why are you overriding this in the first place ??? There seems to be
> no change in functionality or specification.

I missed the covariant change to the return type from 
AbstractStringBuilder to StringBuilder.

I also suggested in email that the above could simply be:

   return super.append(n, cs);

but that would also need a cast to StringBuilder. So what Jim has is fine.

David
-----

> David
> -----
>
>> Thanks,
>> Jim
>>



More information about the core-libs-dev mailing list