From daf9a82e8ce3e6e8e795fcb46309cd8bc4a62e52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B5=D1=80=D0=B3=D0=B5=D0=B9=20=D0=A6=D1=8B=D0=BF?= =?UTF-8?q?=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Tue, 10 Nov 2020 16:25:54 +0200 Subject: [PATCH] Simplify AbstractAspectJAdvice.isVariableName() --- .../aop/aspectj/AbstractAspectJAdvice.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/AbstractAspectJAdvice.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/AbstractAspectJAdvice.java index 32b691f441..1eb0e27456 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/AbstractAspectJAdvice.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/AbstractAspectJAdvice.java @@ -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"); * 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; } - private boolean isVariableName(String name) { - char[] chars = name.toCharArray(); - if (!Character.isJavaIdentifierStart(chars[0])) { + private static boolean isVariableName(String name) { + if (!Character.isJavaIdentifierStart(name.charAt(0))) { return false; } - for (int i = 1; i < chars.length; i++) { - if (!Character.isJavaIdentifierPart(chars[i])) { + for (char ch: name.toCharArray()) { + if (!Character.isJavaIdentifierPart(ch)) { return false; } }