Simplify AbstractAspectJAdvice.isVariableName()

This commit is contained in:
Сергей Цыпанов
2020-11-10 16:25:54 +02:00
committed by Juergen Hoeller
parent b019f30a15
commit daf9a82e8c

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2019 the original author or authors. * Copyright 2002-2020 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.
@@ -350,13 +350,12 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
return this.discoveredThrowingType; return this.discoveredThrowingType;
} }
private boolean isVariableName(String name) { private static boolean isVariableName(String name) {
char[] chars = name.toCharArray(); if (!Character.isJavaIdentifierStart(name.charAt(0))) {
if (!Character.isJavaIdentifierStart(chars[0])) {
return false; return false;
} }
for (int i = 1; i < chars.length; i++) { for (char ch: name.toCharArray()) {
if (!Character.isJavaIdentifierPart(chars[i])) { if (!Character.isJavaIdentifierPart(ch)) {
return false; return false;
} }
} }