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

Ulf Zibis Ulf.Zibis at gmx.de
Thu Aug 23 12:45:58 UTC 2012


Hopefully some day we would have fixed:
Bug 6373386 <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6373386> - Method chaining for 
instance methods that return void

That would prevent us from such bloated sub classes.

Hopefully such "workarounds" would not force later incompatibilities

-Ulf


Am 23.08.2012 02:35, schrieb David Holmes:
> 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
> -----




More information about the core-libs-dev mailing list