This is an automated email from the ASF dual-hosted git repository.
sunlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/master by this push:
new 187fb905ea Trivial refactor: use `String.repeat()` instead
187fb905ea is described below
commit 187fb905eace4496af34218e6cbe5deec4bb354b
Author: Daniel Sun <[email protected]>
AuthorDate: Fri Sep 19 23:56:45 2025 +0900
Trivial refactor: use `String.repeat()` instead
---
.../org/apache/groovy/groovysh/jline/GroovyPosixCommands.java | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git
a/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/jline/GroovyPosixCommands.java
b/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/jline/GroovyPosixCommands.java
index 97feefc590..6d6915b3fa 100644
---
a/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/jline/GroovyPosixCommands.java
+++
b/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/jline/GroovyPosixCommands.java
@@ -523,9 +523,7 @@ public class GroovyPosixCommands extends PosixCommands {
if (username.length() > 8) {
username = new StringBuilder(username.substring(0, 8));
} else {
- for (int i = username.length(); i < 8; i++) {
- username.append(" ");
- }
+ username.append(" ".repeat(Math.max(0, 8 -
username.length())));
}
StringBuilder group;
if (attributes.containsKey("group")) {
@@ -536,9 +534,7 @@ public class GroovyPosixCommands extends PosixCommands {
if (group.length() > 8) {
group = new StringBuilder(group.substring(0, 8));
} else {
- for (int i = group.length(); i < 8; i++) {
- group.append(" ");
- }
+ group.append(" ".repeat(Math.max(0, 8 - group.length())));
}
Number length = (Number) attributes.get("size");
if (length == null) {