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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
|
||||||
|
|
@ -462,7 +462,9 @@ public final class Type {
|
||||||
return "double";
|
return "double";
|
||||||
case ARRAY:
|
case ARRAY:
|
||||||
StringBuilder stringBuilder = new StringBuilder(getElementType().getClassName());
|
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();
|
return stringBuilder.toString();
|
||||||
case OBJECT:
|
case OBJECT:
|
||||||
case INTERNAL:
|
case INTERNAL:
|
||||||
|
|
|
||||||
|
|
@ -218,7 +218,9 @@ public class ReflectUtils {
|
||||||
dimensions++;
|
dimensions++;
|
||||||
}
|
}
|
||||||
StringBuilder brackets = new StringBuilder(className.length() - 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);
|
className = className.substring(0, className.length() - 2 * dimensions);
|
||||||
|
|
||||||
String prefix = (dimensions > 0) ? brackets + "L" : "";
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
|
||||||
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
|
||||||
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
|
||||||
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue