Hoist concatenation of two constant Strings out of loops

Closes gh-24388
This commit is contained in:
Сергей Цыпанов 2020-01-17 17:59:39 +02:00 committed by Sam Brannen
parent 59bef22235
commit 3adc7c3059
2 changed files with 7 additions and 3 deletions

View File

@ -422,10 +422,13 @@ public class PropertiesBeanDefinitionReader extends AbstractBeanDefinitionReader
ConstructorArgumentValues cas = new ConstructorArgumentValues();
MutablePropertyValues pvs = new MutablePropertyValues();
String prefixWithSep = prefix + SEPARATOR;
int beginIndex = prefix.length() + SEPARATOR.length();
for (Map.Entry<?, ?> entry : map.entrySet()) {
String key = StringUtils.trimWhitespace((String) entry.getKey());
if (key.startsWith(prefix + SEPARATOR)) {
String property = key.substring(prefix.length() + SEPARATOR.length());
if (key.startsWith(prefixWithSep)) {
String property = key.substring(beginIndex);
if (CLASS_KEY.equals(property)) {
className = StringUtils.trimWhitespace((String) entry.getValue());
}

View File

@ -166,9 +166,10 @@ public class AnnotationMetadataReadingVisitor extends ClassMetadataReadingVisito
if (attributes == null) {
return null;
}
String annotatedElement = "class '" + getClassName() + "'";
for (AnnotationAttributes raw : attributes) {
for (Map.Entry<String, Object> entry : AnnotationReadingVisitorUtils.convertClassValues(
"class '" + getClassName() + "'", this.classLoader, raw, classValuesAsString).entrySet()) {
annotatedElement, this.classLoader, raw, classValuesAsString).entrySet()) {
allAttributes.add(entry.getKey(), entry.getValue());
}
}