Polish "Use String.repeat instead of explicit cycle"
See gh-31802
This commit is contained in:
@@ -462,7 +462,9 @@ public final class Type {
|
||||
return "double";
|
||||
case ARRAY:
|
||||
StringBuilder stringBuilder = new StringBuilder(getElementType().getClassName());
|
||||
stringBuilder.append("[]".repeat(Math.max(0, getDimensions())));
|
||||
for (int i = getDimensions(); i > 0; --i) {
|
||||
stringBuilder.append("[]");
|
||||
}
|
||||
return stringBuilder.toString();
|
||||
case OBJECT:
|
||||
case INTERNAL:
|
||||
|
||||
@@ -218,7 +218,9 @@ public class ReflectUtils {
|
||||
dimensions++;
|
||||
}
|
||||
StringBuilder brackets = new StringBuilder(className.length() - dimensions);
|
||||
brackets.append("[".repeat(Math.max(0, dimensions)));
|
||||
for (int i = 0; i < dimensions; i++) {
|
||||
brackets.append('[');
|
||||
}
|
||||
className = className.substring(0, className.length() - 2 * dimensions);
|
||||
|
||||
String prefix = (dimensions > 0) ? brackets + "L" : "";
|
||||
|
||||
Reference in New Issue
Block a user