RFR: 8264029: Replace uses of StringBuffer with StringBuilder in java.base

Pavel Rappo prappo at openjdk.java.net
Tue Mar 23 12:40:41 UTC 2021


On Wed, 10 Mar 2021 19:47:00 GMT, Andrey Turbanov <github.com+741251+turbanoff at openjdk.org> wrote:

> Found by IntelliJ IDEA inspection `Java | Java language level migration aids | Java 5 | 'StringBuffer' may be 'StringBuilder'`
> As suggested in https://github.com/openjdk/jdk/pull/1507#issuecomment-757369003 I've created separate PR for module `java.base`
> Similar cleanup in the past - https://bugs.openjdk.java.net/browse/JDK-8041679

src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java line 1954:

> 1952:             for (int i = 0; i < 4; ++i) {
> 1953:                 if (i > 0) {
> 1954:                     sb.append("       ");

Consider using `String.repeat` here and on L1960 for clarity.

src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java line 1954:

> 1952:             for (int i = 0; i < 4; ++i) {
> 1953:                 if (i > 0) {
> 1954:                     sb.append("       ");

Consider using `String.repeat` here and on L1960 for clarity.

-------------

PR: https://git.openjdk.java.net/jdk/pull/2922


More information about the nio-dev mailing list