Replace StringBuffers to StringBuilders in tests
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
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. 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
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
Hi Daniel and David, Thanks for your opinions and for sharing more context - it is definitely clearer now! I am glad that I reached out to the mailing list first instead of going ahead with the changes! :) Regards, Sergei Sent with ProtonMail Secure Email. ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ On Friday, August 27th, 2021 at 15:14, David Holmes <david.holmes@oracle.com> wrote:
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
participants (3)
-
Daniel Fuchs
-
David Holmes
-
Sergei Ustimenko