On Tue, 23 Mar 2021 20:44:17 GMT, Andrey Turbanov <github.com+741251+turbanoff@openjdk.org> wrote:
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.
I'm not sure how String.repeat can be used here. Repeated String is not constant and different for each iteration.
Long runs of whitespace, especially in blank strings, may have poor readability. I was thinking that " ".repeat(7) and " ".repeat(10) might read better than " " and " " respectively. If you don't agree, then simply disregard what I said. If you agree but worry about negative performance implications, consider creating these strings before the respective for-loops. ------------- PR: https://git.openjdk.java.net/jdk/pull/2922