RFR 6856817: Poor performance of Writer#append with CharBuffer

Aleksey Shipilev aleksey.shipilev at oracle.com
Wed Nov 25 15:33:13 UTC 2015

On 11/25/2015 06:22 PM, Aleksey Shipilev wrote:
> On 11/25/2015 05:29 PM, vyom wrote:
>> Please review my changes for below bug.
>> Bug:        JDK-6856817 : Poor performance of Writer#append with CharBuffer
>> Webrev: http://cr.openjdk.java.net/~vtewari/6856817/webrev0.4/
> Interesting change.
> But, I think the "null" handling in new OSW.append methods is incorrect.
> Javadoc says that those methods should behave exactly as:
>   out.write(csq.toString())
> or:
>  out.write(csq.subSequence(start, end).toString())
> If CharSequence is null, we should throw NullPointerException, not doing
> any "null" mangling, as your patch does? If so, can you please fix this
> and add more tests?

Ah, apologies, the Javadoc is puzzling for Writer.append(CharSequence):
the @param declaration says that if CharSequence is null, it is treated
as if containing "null", contradicting what is said before in the same

OTOH, Writer.append(CharSequence, int, int) has the escape clause "when
csq is not null". I think that specification for
Writer.append(CharSequence) should mention that as well, please file a
cleanup RFE and CCC?

Otherwise the changes look good to me.


More information about the core-libs-dev mailing list