Reduce overhead of char[] creation

There are more locations which could benefit from not using a
toCharArray on a String, but rather use the charAt method from
the String itself. This to prevent an additional copy of the
char[] being created.
This commit is contained in:
Marten Deinum
2020-11-17 11:52:58 +01:00
committed by Juergen Hoeller
parent 9139cb85bd
commit c9b27af64f
9 changed files with 20 additions and 24 deletions

View File

@@ -475,8 +475,8 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
}
if (Character.isJavaIdentifierStart(candidateToken.charAt(0)) &&
Character.isLowerCase(candidateToken.charAt(0))) {
char[] tokenChars = candidateToken.toCharArray();
for (char tokenChar : tokenChars) {
for (int i = 1; i < candidateToken.length(); i++) {
char tokenChar = candidateToken.charAt(i);
if (!Character.isJavaIdentifierPart(tokenChar)) {
return null;
}