Replace StringBuffers to StringBuilders in tests

Sergei Ustimenko fdesu at protonmail.com
Fri Aug 27 10:00:37 UTC 2021


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