Replace StringBuffers to StringBuilders in tests

David Holmes david.holmes at oracle.com
Fri Aug 27 13:14:37 UTC 2021


On 27/08/2021 8:42 pm, Daniel Fuchs wrote:
> Hi Sergei,
> 
> I wouldn't bother replacing StringBuffers with StringDuilders in tests.
> It seems a bit gratuitous - and possibly could complicate future
> tests backports.
> 
> But that's my personal opinion. Others might disagree.

I agree with you. Complete waste of time and effort for zero benefit 
IMO. Sorry Sergei.

Cheers,
David

> best regards,
> 
> -- daniel
> 
> On 27/08/2021 11:00, Sergei Ustimenko wrote:
>> Hi all,
>>
>> Some tests use StringBuffers instead of StringBuilders where 
>> additional thread-safety
>> is not required as e.g. in 
>> test/jdk/sun/util/resources/TimeZone/Bug4640234.java:82 :
>> ...
>>
>> StringBuffer errors
>>
>> =
>>
>> new
>>
>> StringBuffer(
>>
>> ""
>>
>> );
>>
>> StringBuffer warnings
>>
>> =
>>
>> new
>>
>> StringBuffer(
>>
>> ""
>>
>> );
>>
>> ...
>> There were some efforts to clean up core libs (e.g. java.base module in
>> https://github.com/openjdk/jdk/pull/2922) and I've noticed some tests 
>> that could be
>> improved as well.
>>
>> Now there are about 300 tests for different modules that in general 
>> use StringBuffers
>> (most probably some of them not without a reason) so is it something 
>> worth looking
>> into? What you think about it?
>>
>> Regards,
>> Sergei
>>
> 


More information about the core-libs-dev mailing list