Polish "Use String.repeat instead of explicit cycle"
See gh-31802
This commit is contained in:
parent
63b2787da6
commit
d0574197ea
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -98,7 +98,7 @@ public final class ParseState {
|
|||
for (ParseState.Entry entry : this.state) {
|
||||
if (i > 0) {
|
||||
sb.append('\n');
|
||||
sb.append("\t".repeat(i));
|
||||
sb.append("\t".repeat(i));
|
||||
sb.append("-> ");
|
||||
}
|
||||
sb.append(entry);
|
||||
|
|
|
|||
|
|
@ -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" : "";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -68,7 +68,7 @@ public class PatternParseException extends IllegalArgumentException {
|
|||
public String toDetailedString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(this.pattern).append('\n');
|
||||
sb.append(" ".repeat(Math.max(0, this.position)));
|
||||
sb.append(" ".repeat(Math.max(0, this.position)));
|
||||
sb.append("^\n");
|
||||
sb.append(getMessage());
|
||||
return sb.toString();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -81,7 +81,7 @@ class ToStringVisitor implements RouterFunctions.Visitor, RequestPredicates.Visi
|
|||
}
|
||||
|
||||
private void indent() {
|
||||
this.builder.append(" ".repeat(Math.max(0, this.indent)));
|
||||
this.builder.append(" ".repeat(Math.max(0, this.indent)));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -80,7 +80,7 @@ class ToStringVisitor implements RouterFunctions.Visitor, RequestPredicates.Visi
|
|||
}
|
||||
|
||||
private void indent() {
|
||||
this.builder.append(" ".repeat(Math.max(0, this.indent)));
|
||||
this.builder.append(" ".repeat(Math.max(0, this.indent)));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -59,7 +59,7 @@ public abstract class AbstractSockJsMessageCodec implements SockJsMessageCodec {
|
|||
if (isSockJsSpecialChar(c)) {
|
||||
result.append('\\').append('u');
|
||||
String hex = Integer.toHexString(c).toLowerCase();
|
||||
result.append("0".repeat(Math.max(0, (4 - hex.length()))));
|
||||
result.append("0".repeat(Math.max(0, (4 - hex.length()))));
|
||||
result.append(hex);
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue