diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscoverer.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscoverer.java
index ffcea9d0b0c..60a45977513 100644
--- a/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscoverer.java
+++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscoverer.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2020 the original author or authors.
+ * Copyright 2002-2021 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.
@@ -625,7 +625,7 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
StringBuilder sb = new StringBuilder();
if (bodyStart >= 0 && bodyStart != (currentToken.length() - 1)) {
sb.append(currentToken.substring(bodyStart + 1));
- sb.append(" ");
+ sb.append(' ');
}
numTokensConsumed++;
int currentIndex = startIndex + numTokensConsumed;
@@ -645,7 +645,7 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
toAppend = toAppend.substring(1);
}
sb.append(toAppend);
- sb.append(" ");
+ sb.append(' ');
currentIndex++;
numTokensConsumed++;
}
diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcut.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcut.java
index 1cdef3141da..8b5e5f6f3e0 100644
--- a/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcut.java
+++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcut.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2018 the original author or authors.
+ * Copyright 2002-2021 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.
@@ -547,7 +547,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
StringBuilder sb = new StringBuilder("AspectJExpressionPointcut: (");
for (int i = 0; i < this.pointcutParameterTypes.length; i++) {
sb.append(this.pointcutParameterTypes[i].getName());
- sb.append(" ");
+ sb.append(' ');
sb.append(this.pointcutParameterNames[i]);
if ((i+1) < this.pointcutParameterTypes.length) {
sb.append(", ");
diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/MethodInvocationProceedingJoinPoint.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/MethodInvocationProceedingJoinPoint.java
index d25ec2eb6bc..ef9016a1572 100644
--- a/spring-aop/src/main/java/org/springframework/aop/aspectj/MethodInvocationProceedingJoinPoint.java
+++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/MethodInvocationProceedingJoinPoint.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2020 the original author or authors.
+ * Copyright 2002-2021 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.
@@ -255,19 +255,19 @@ public class MethodInvocationProceedingJoinPoint implements ProceedingJoinPoint,
StringBuilder sb = new StringBuilder();
if (includeModifier) {
sb.append(Modifier.toString(getModifiers()));
- sb.append(" ");
+ sb.append(' ');
}
if (includeReturnTypeAndArgs) {
appendType(sb, getReturnType(), useLongReturnAndArgumentTypeName);
- sb.append(" ");
+ sb.append(' ');
}
appendType(sb, getDeclaringType(), useLongTypeName);
- sb.append(".");
+ sb.append('.');
sb.append(getMethod().getName());
- sb.append("(");
+ sb.append('(');
Class>[] parametersTypes = getParameterTypes();
appendTypes(sb, parametersTypes, includeReturnTypeAndArgs, useLongReturnAndArgumentTypeName);
- sb.append(")");
+ sb.append(')');
return sb.toString();
}
@@ -278,7 +278,7 @@ public class MethodInvocationProceedingJoinPoint implements ProceedingJoinPoint,
for (int size = types.length, i = 0; i < size; i++) {
appendType(sb, types[i], useLongReturnAndArgumentTypeName);
if (i < size - 1) {
- sb.append(",");
+ sb.append(',');
}
}
}
diff --git a/spring-aop/src/main/java/org/springframework/aop/support/AbstractBeanFactoryPointcutAdvisor.java b/spring-aop/src/main/java/org/springframework/aop/support/AbstractBeanFactoryPointcutAdvisor.java
index ac69e3962b0..ccb008ebd01 100644
--- a/spring-aop/src/main/java/org/springframework/aop/support/AbstractBeanFactoryPointcutAdvisor.java
+++ b/spring-aop/src/main/java/org/springframework/aop/support/AbstractBeanFactoryPointcutAdvisor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2017 the original author or authors.
+ * Copyright 2002-2021 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.
@@ -137,7 +137,7 @@ public abstract class AbstractBeanFactoryPointcutAdvisor extends AbstractPointcu
StringBuilder sb = new StringBuilder(getClass().getName());
sb.append(": advice ");
if (this.adviceBeanName != null) {
- sb.append("bean '").append(this.adviceBeanName).append("'");
+ sb.append("bean '").append(this.adviceBeanName).append('\'');
}
else {
sb.append(this.advice);
diff --git a/spring-aop/src/main/java/org/springframework/aop/target/AbstractBeanFactoryBasedTargetSource.java b/spring-aop/src/main/java/org/springframework/aop/target/AbstractBeanFactoryBasedTargetSource.java
index cf32c396d84..78c6d3abf6d 100644
--- a/spring-aop/src/main/java/org/springframework/aop/target/AbstractBeanFactoryBasedTargetSource.java
+++ b/spring-aop/src/main/java/org/springframework/aop/target/AbstractBeanFactoryBasedTargetSource.java
@@ -191,9 +191,9 @@ public abstract class AbstractBeanFactoryBasedTargetSource implements TargetSour
@Override
public String toString() {
StringBuilder sb = new StringBuilder(getClass().getSimpleName());
- sb.append(" for target bean '").append(this.targetBeanName).append("'");
+ sb.append(" for target bean '").append(this.targetBeanName).append('\'');
if (this.targetClass != null) {
- sb.append(" of type [").append(this.targetClass.getName()).append("]");
+ sb.append(" of type [").append(this.targetClass.getName()).append(']');
}
return sb.toString();
}
diff --git a/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscovererTests.java b/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscovererTests.java
index bd37f5d3770..40a5de33103 100644
--- a/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscovererTests.java
+++ b/spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJAdviceParameterNameDiscovererTests.java
@@ -276,14 +276,14 @@ public class AspectJAdviceParameterNameDiscovererTests {
private static String format(String[] names) {
StringBuilder sb = new StringBuilder();
- sb.append("(");
+ sb.append('(');
for (int i = 0; i < names.length; i++) {
sb.append(names[i]);
if ((i + 1) < names.length) {
- sb.append(",");
+ sb.append(',');
}
}
- sb.append(")");
+ sb.append(')');
return sb.toString();
}
diff --git a/spring-beans/src/main/java/org/springframework/beans/TypeConverterDelegate.java b/spring-beans/src/main/java/org/springframework/beans/TypeConverterDelegate.java
index 38a59ba3d68..2c419b1c109 100644
--- a/spring-beans/src/main/java/org/springframework/beans/TypeConverterDelegate.java
+++ b/spring-beans/src/main/java/org/springframework/beans/TypeConverterDelegate.java
@@ -247,14 +247,14 @@ class TypeConverterDelegate {
// Definitely doesn't match: throw IllegalArgumentException/IllegalStateException
StringBuilder msg = new StringBuilder();
msg.append("Cannot convert value of type '").append(ClassUtils.getDescriptiveType(newValue));
- msg.append("' to required type '").append(ClassUtils.getQualifiedName(requiredType)).append("'");
+ msg.append("' to required type '").append(ClassUtils.getQualifiedName(requiredType)).append('\'');
if (propertyName != null) {
- msg.append(" for property '").append(propertyName).append("'");
+ msg.append(" for property '").append(propertyName).append('\'');
}
if (editor != null) {
msg.append(": PropertyEditor [").append(editor.getClass().getName()).append(
"] returned inappropriate value of type '").append(
- ClassUtils.getDescriptiveType(convertedValue)).append("'");
+ ClassUtils.getDescriptiveType(convertedValue)).append('\'');
throw new IllegalArgumentException(msg.toString());
}
else {
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/RequiredAnnotationBeanPostProcessor.java b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/RequiredAnnotationBeanPostProcessor.java
index 9978f979b50..a4cf5f314ce 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/RequiredAnnotationBeanPostProcessor.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/RequiredAnnotationBeanPostProcessor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2020 the original author or authors.
+ * Copyright 2002-2021 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.
@@ -217,13 +217,13 @@ public class RequiredAnnotationBeanPostProcessor implements SmartInstantiationAw
sb.append(" and");
}
else {
- sb.append(",");
+ sb.append(',');
}
}
- sb.append(" '").append(propertyName).append("'");
+ sb.append(" '").append(propertyName).append('\'');
}
sb.append(size == 1 ? " is" : " are");
- sb.append(" required for bean '").append(beanName).append("'");
+ sb.append(" required for bean '").append(beanName).append('\'');
return sb.toString();
}
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java
index 5b5471a8832..2ceff658dbc 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java
@@ -1241,7 +1241,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
@Override
public String toString() {
StringBuilder sb = new StringBuilder("class [");
- sb.append(getBeanClassName()).append("]");
+ sb.append(getBeanClassName()).append(']');
sb.append("; scope=").append(this.scope);
sb.append("; abstract=").append(this.abstractFlag);
sb.append("; lazyInit=").append(this.lazyInit);
diff --git a/spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/AbstractJCacheOperation.java b/spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/AbstractJCacheOperation.java
index d1771b1bd6e..036a4f6cb58 100644
--- a/spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/AbstractJCacheOperation.java
+++ b/spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/AbstractJCacheOperation.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2019 the original author or authors.
+ * Copyright 2002-2021 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.
@@ -138,7 +138,7 @@ abstract class AbstractJCacheOperation implements JCacheOp
@Override
public String toString() {
- return getOperationDescription().append("]").toString();
+ return getOperationDescription().append(']').toString();
}
/**
@@ -148,7 +148,7 @@ abstract class AbstractJCacheOperation implements JCacheOp
protected StringBuilder getOperationDescription() {
StringBuilder result = new StringBuilder();
result.append(getClass().getSimpleName());
- result.append("[");
+ result.append('[');
result.append(this.methodDetails);
return result;
}
diff --git a/spring-context/src/main/java/org/springframework/cache/interceptor/CacheEvictOperation.java b/spring-context/src/main/java/org/springframework/cache/interceptor/CacheEvictOperation.java
index 7e72078a1d2..ee9ec6e95c6 100644
--- a/spring-context/src/main/java/org/springframework/cache/interceptor/CacheEvictOperation.java
+++ b/spring-context/src/main/java/org/springframework/cache/interceptor/CacheEvictOperation.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2018 the original author or authors.
+ * Copyright 2002-2021 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.
@@ -71,9 +71,9 @@ public class CacheEvictOperation extends CacheOperation {
@Override
protected StringBuilder getOperationDescription() {
StringBuilder sb = super.getOperationDescription();
- sb.append(",");
+ sb.append(',');
sb.append(this.cacheWide);
- sb.append(",");
+ sb.append(',');
sb.append(this.beforeInvocation);
return sb;
}
diff --git a/spring-context/src/main/java/org/springframework/cache/interceptor/CacheOperation.java b/spring-context/src/main/java/org/springframework/cache/interceptor/CacheOperation.java
index 69f7305373f..aaee9b396b7 100644
--- a/spring-context/src/main/java/org/springframework/cache/interceptor/CacheOperation.java
+++ b/spring-context/src/main/java/org/springframework/cache/interceptor/CacheOperation.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2018 the original author or authors.
+ * Copyright 2002-2021 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.
@@ -216,13 +216,13 @@ public abstract class CacheOperation implements BasicOperation {
*/
protected StringBuilder getOperationDescription() {
StringBuilder result = new StringBuilder(getClass().getSimpleName());
- result.append("[").append(this.name);
+ result.append('[').append(this.name);
result.append("] caches=").append(this.cacheNames);
result.append(" | key='").append(this.key);
result.append("' | keyGenerator='").append(this.keyGenerator);
result.append("' | cacheManager='").append(this.cacheManager);
result.append("' | cacheResolver='").append(this.cacheResolver);
- result.append("' | condition='").append(this.condition).append("'");
+ result.append("' | condition='").append(this.condition).append('\'');
return result;
}
diff --git a/spring-context/src/main/java/org/springframework/cache/interceptor/CachePutOperation.java b/spring-context/src/main/java/org/springframework/cache/interceptor/CachePutOperation.java
index d5b39ee788c..4b94ac5edff 100644
--- a/spring-context/src/main/java/org/springframework/cache/interceptor/CachePutOperation.java
+++ b/spring-context/src/main/java/org/springframework/cache/interceptor/CachePutOperation.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2018 the original author or authors.
+ * Copyright 2002-2021 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.
@@ -66,7 +66,7 @@ public class CachePutOperation extends CacheOperation {
StringBuilder sb = super.getOperationDescription();
sb.append(" | unless='");
sb.append(this.unless);
- sb.append("'");
+ sb.append('\'');
return sb;
}
diff --git a/spring-context/src/main/java/org/springframework/cache/interceptor/CacheableOperation.java b/spring-context/src/main/java/org/springframework/cache/interceptor/CacheableOperation.java
index 922407d3357..9f7fcc2e97b 100644
--- a/spring-context/src/main/java/org/springframework/cache/interceptor/CacheableOperation.java
+++ b/spring-context/src/main/java/org/springframework/cache/interceptor/CacheableOperation.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2018 the original author or authors.
+ * Copyright 2002-2021 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.
@@ -79,10 +79,10 @@ public class CacheableOperation extends CacheOperation {
StringBuilder sb = super.getOperationDescription();
sb.append(" | unless='");
sb.append(this.unless);
- sb.append("'");
+ sb.append('\'');
sb.append(" | sync='");
sb.append(this.sync);
- sb.append("'");
+ sb.append('\'');
return sb;
}
diff --git a/spring-context/src/main/java/org/springframework/context/event/ApplicationListenerMethodAdapter.java b/spring-context/src/main/java/org/springframework/context/event/ApplicationListenerMethodAdapter.java
index e78c794ca55..bc7e1f93989 100644
--- a/spring-context/src/main/java/org/springframework/context/event/ApplicationListenerMethodAdapter.java
+++ b/spring-context/src/main/java/org/springframework/context/event/ApplicationListenerMethodAdapter.java
@@ -396,7 +396,7 @@ public class ApplicationListenerMethodAdapter implements GenericApplicationListe
* @param message error message to append the HandlerMethod details to
*/
protected String getDetailedErrorMessage(Object bean, String message) {
- StringBuilder sb = new StringBuilder(message).append("\n");
+ StringBuilder sb = new StringBuilder(message).append('\n');
sb.append("HandlerMethod details: \n");
sb.append("Bean [").append(bean.getClass().getName()).append("]\n");
sb.append("Method [").append(this.method.toGenericString()).append("]\n");
@@ -426,7 +426,7 @@ public class ApplicationListenerMethodAdapter implements GenericApplicationListe
StringBuilder sb = new StringBuilder(getDetailedErrorMessage(bean, message));
sb.append("Resolved arguments: \n");
for (int i = 0; i < resolvedArgs.length; i++) {
- sb.append("[").append(i).append("] ");
+ sb.append('[').append(i).append("] ");
if (resolvedArgs[i] == null) {
sb.append("[null] \n");
}
diff --git a/spring-context/src/main/java/org/springframework/context/support/LiveBeansView.java b/spring-context/src/main/java/org/springframework/context/support/LiveBeansView.java
index 668710f02bd..96a9b212e39 100644
--- a/spring-context/src/main/java/org/springframework/context/support/LiveBeansView.java
+++ b/spring-context/src/main/java/org/springframework/context/support/LiveBeansView.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2020 the original author or authors.
+ * Copyright 2002-2021 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.
@@ -205,12 +205,12 @@ public class LiveBeansView implements LiveBeansViewMBean, ApplicationContextAwar
}
}
result.append("]\n");
- result.append("}");
+ result.append('}');
if (it.hasNext()) {
result.append(",\n");
}
}
- result.append("]");
+ result.append(']');
return result.toString();
}
diff --git a/spring-core/src/main/java/org/springframework/core/Constants.java b/spring-core/src/main/java/org/springframework/core/Constants.java
index 1515955483f..8e91d511c10 100644
--- a/spring-core/src/main/java/org/springframework/core/Constants.java
+++ b/spring-core/src/main/java/org/springframework/core/Constants.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2018 the original author or authors.
+ * Copyright 2002-2021 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.
@@ -324,7 +324,7 @@ public class Constants {
for (int i = 0; i < propertyName.length(); i++) {
char c = propertyName.charAt(i);
if (Character.isUpperCase(c)) {
- parsedPrefix.append("_");
+ parsedPrefix.append('_');
parsedPrefix.append(c);
}
else {
diff --git a/spring-core/src/main/java/org/springframework/core/annotation/AnnotationAttributes.java b/spring-core/src/main/java/org/springframework/core/annotation/AnnotationAttributes.java
index 3a6f44f3ead..d864a4cb1e1 100644
--- a/spring-core/src/main/java/org/springframework/core/annotation/AnnotationAttributes.java
+++ b/spring-core/src/main/java/org/springframework/core/annotation/AnnotationAttributes.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2019 the original author or authors.
+ * Copyright 2002-2021 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.
@@ -394,9 +394,11 @@ public class AnnotationAttributes extends LinkedHashMap {
sb.append(entry.getKey());
sb.append('=');
sb.append(valueToString(entry.getValue()));
- sb.append(entries.hasNext() ? ", " : "");
+ if (entries.hasNext()) {
+ sb.append(", ");
+ }
}
- sb.append("}");
+ sb.append('}');
return sb.toString();
}
diff --git a/spring-core/src/main/java/org/springframework/core/annotation/SynthesizedMergedAnnotationInvocationHandler.java b/spring-core/src/main/java/org/springframework/core/annotation/SynthesizedMergedAnnotationInvocationHandler.java
index 16a5e82b4b6..0201e15e269 100644
--- a/spring-core/src/main/java/org/springframework/core/annotation/SynthesizedMergedAnnotationInvocationHandler.java
+++ b/spring-core/src/main/java/org/springframework/core/annotation/SynthesizedMergedAnnotationInvocationHandler.java
@@ -177,17 +177,17 @@ final class SynthesizedMergedAnnotationInvocationHandler i
private String annotationToString() {
String string = this.string;
if (string == null) {
- StringBuilder builder = new StringBuilder("@").append(this.type.getName()).append("(");
+ StringBuilder builder = new StringBuilder("@").append(this.type.getName()).append('(');
for (int i = 0; i < this.attributes.size(); i++) {
Method attribute = this.attributes.get(i);
if (i > 0) {
builder.append(", ");
}
builder.append(attribute.getName());
- builder.append("=");
+ builder.append('=');
builder.append(toString(getAttributeValue(attribute)));
}
- builder.append(")");
+ builder.append(')');
string = builder.toString();
this.string = string;
}
@@ -206,7 +206,7 @@ final class SynthesizedMergedAnnotationInvocationHandler i
}
builder.append(toString(Array.get(value, i)));
}
- builder.append("]");
+ builder.append(']');
return builder.toString();
}
return String.valueOf(value);
diff --git a/spring-core/src/main/java/org/springframework/core/convert/TypeDescriptor.java b/spring-core/src/main/java/org/springframework/core/convert/TypeDescriptor.java
index de43740b852..1bc8cb281b1 100644
--- a/spring-core/src/main/java/org/springframework/core/convert/TypeDescriptor.java
+++ b/spring-core/src/main/java/org/springframework/core/convert/TypeDescriptor.java
@@ -513,7 +513,7 @@ public class TypeDescriptor implements Serializable {
public String toString() {
StringBuilder builder = new StringBuilder();
for (Annotation ann : getAnnotations()) {
- builder.append("@").append(ann.annotationType().getName()).append(' ');
+ builder.append('@').append(ann.annotationType().getName()).append(' ');
}
builder.append(getResolvableType());
return builder.toString();
diff --git a/spring-core/src/main/java/org/springframework/util/StopWatch.java b/spring-core/src/main/java/org/springframework/util/StopWatch.java
index 8076ed042d1..505c27dbd10 100644
--- a/spring-core/src/main/java/org/springframework/util/StopWatch.java
+++ b/spring-core/src/main/java/org/springframework/util/StopWatch.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2020 the original author or authors.
+ * Copyright 2002-2021 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.
@@ -302,7 +302,7 @@ public class StopWatch {
for (TaskInfo task : getTaskInfo()) {
sb.append(nf.format(task.getTimeNanos())).append(" ");
sb.append(pf.format((double) task.getTimeNanos() / getTotalTimeNanos())).append(" ");
- sb.append(task.getTaskName()).append("\n");
+ sb.append(task.getTaskName()).append('\n');
}
}
return sb.toString();
@@ -320,7 +320,7 @@ public class StopWatch {
for (TaskInfo task : getTaskInfo()) {
sb.append("; [").append(task.getTaskName()).append("] took ").append(task.getTimeNanos()).append(" ns");
long percent = Math.round(100.0 * task.getTimeNanos() / getTotalTimeNanos());
- sb.append(" = ").append(percent).append("%");
+ sb.append(" = ").append(percent).append('%');
}
}
else {
diff --git a/spring-core/src/test/java/org/springframework/util/FastByteArrayOutputStreamTests.java b/spring-core/src/test/java/org/springframework/util/FastByteArrayOutputStreamTests.java
index 9831d5c07f7..692d6876f15 100644
--- a/spring-core/src/test/java/org/springframework/util/FastByteArrayOutputStreamTests.java
+++ b/spring-core/src/test/java/org/springframework/util/FastByteArrayOutputStreamTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2019 the original author or authors.
+ * Copyright 2002-2021 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.
@@ -194,7 +194,7 @@ class FastByteArrayOutputStreamTests {
this.os.write(this.helloBytes);
InputStream inputStream = this.os.getInputStream();
DigestUtils.appendMd5DigestAsHex(inputStream, builder);
- builder.append("\"");
+ builder.append('"');
String actual = builder.toString();
assertThat(actual).isEqualTo("\"0b10a8db164e0754105b7a99be72e3fe5\"");
}
@@ -208,7 +208,7 @@ class FastByteArrayOutputStreamTests {
}
InputStream inputStream = this.os.getInputStream();
DigestUtils.appendMd5DigestAsHex(inputStream, builder);
- builder.append("\"");
+ builder.append('"');
String actual = builder.toString();
assertThat(actual).isEqualTo("\"06225ca1e4533354c516e74512065331d\"");
}
diff --git a/spring-core/src/test/java/org/springframework/util/StringUtilsTests.java b/spring-core/src/test/java/org/springframework/util/StringUtilsTests.java
index 145a44275f1..9d81c82d5f1 100644
--- a/spring-core/src/test/java/org/springframework/util/StringUtilsTests.java
+++ b/spring-core/src/test/java/org/springframework/util/StringUtilsTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2020 the original author or authors.
+ * Copyright 2002-2021 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.
@@ -612,7 +612,7 @@ class StringUtilsTests {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < components.length; i++) {
if (i != 0) {
- sb.append(",");
+ sb.append(',');
}
sb.append(components[i]);
}
diff --git a/spring-expression/src/main/java/org/springframework/expression/ExpressionException.java b/spring-expression/src/main/java/org/springframework/expression/ExpressionException.java
index 5d6f4aec953..0d4cb1859bd 100644
--- a/spring-expression/src/main/java/org/springframework/expression/ExpressionException.java
+++ b/spring-expression/src/main/java/org/springframework/expression/ExpressionException.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2018 the original author or authors.
+ * Copyright 2002-2021 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.
@@ -137,7 +137,7 @@ public class ExpressionException extends RuntimeException {
StringBuilder output = new StringBuilder();
output.append("Expression [");
output.append(this.expressionString);
- output.append("]");
+ output.append(']');
if (this.position >= 0) {
output.append(" @");
output.append(this.position);
diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/CodeFlow.java b/spring-expression/src/main/java/org/springframework/expression/spel/CodeFlow.java
index cce05824aeb..393946b2162 100644
--- a/spring-expression/src/main/java/org/springframework/expression/spel/CodeFlow.java
+++ b/spring-expression/src/main/java/org/springframework/expression/spel/CodeFlow.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2018 the original author or authors.
+ * Copyright 2002-2021 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.
@@ -432,11 +432,11 @@ public class CodeFlow implements Opcodes {
public static String createSignatureDescriptor(Method method) {
Class>[] params = method.getParameterTypes();
StringBuilder sb = new StringBuilder();
- sb.append("(");
+ sb.append('(');
for (Class> param : params) {
sb.append(toJvmDescriptor(param));
}
- sb.append(")");
+ sb.append(')');
sb.append(toJvmDescriptor(method.getReturnType()));
return sb.toString();
}
@@ -453,7 +453,7 @@ public class CodeFlow implements Opcodes {
public static String createSignatureDescriptor(Constructor> ctor) {
Class>[] params = ctor.getParameterTypes();
StringBuilder sb = new StringBuilder();
- sb.append("(");
+ sb.append('(');
for (Class> param : params) {
sb.append(toJvmDescriptor(param));
}
@@ -473,7 +473,7 @@ public class CodeFlow implements Opcodes {
StringBuilder sb = new StringBuilder();
if (clazz.isArray()) {
while (clazz.isArray()) {
- sb.append("[");
+ sb.append('[');
clazz = clazz.getComponentType();
}
}
@@ -507,9 +507,9 @@ public class CodeFlow implements Opcodes {
}
}
else {
- sb.append("L");
+ sb.append('L');
sb.append(clazz.getName().replace('.', '/'));
- sb.append(";");
+ sb.append(';');
}
return sb.toString();
}
diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/SpelMessage.java b/spring-expression/src/main/java/org/springframework/expression/spel/SpelMessage.java
index 8998cb29888..3a03cfd9a1a 100644
--- a/spring-expression/src/main/java/org/springframework/expression/spel/SpelMessage.java
+++ b/spring-expression/src/main/java/org/springframework/expression/spel/SpelMessage.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2018 the original author or authors.
+ * Copyright 2002-2021 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.
@@ -284,7 +284,7 @@ public enum SpelMessage {
formattedMessage.append("EL").append(this.code);
switch (this.kind) {
case ERROR:
- formattedMessage.append("E");
+ formattedMessage.append('E');
break;
}
formattedMessage.append(": ");
diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/BeanReference.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/BeanReference.java
index a59d98250fb..6e128dae611 100644
--- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/BeanReference.java
+++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/BeanReference.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2019 the original author or authors.
+ * Copyright 2002-2021 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.
@@ -64,13 +64,13 @@ public class BeanReference extends SpelNodeImpl {
public String toStringAST() {
StringBuilder sb = new StringBuilder();
if (!this.beanName.startsWith(FACTORY_BEAN_PREFIX)) {
- sb.append("@");
+ sb.append('@');
}
if (!this.beanName.contains(".")) {
sb.append(this.beanName);
}
else {
- sb.append("'").append(this.beanName).append("'");
+ sb.append('\'').append(this.beanName).append('\'');
}
return sb.toString();
}
diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/ConstructorReference.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/ConstructorReference.java
index c70fcfb6da2..7ccc4c16d96 100644
--- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/ConstructorReference.java
+++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/ConstructorReference.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2019 the original author or authors.
+ * Copyright 2002-2021 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.
@@ -208,14 +208,14 @@ public class ConstructorReference extends SpelNodeImpl {
StringBuilder sb = new StringBuilder("new ");
int index = 0;
sb.append(getChild(index++).toStringAST());
- sb.append("(");
+ sb.append('(');
for (int i = index; i < getChildCount(); i++) {
if (i > index) {
- sb.append(",");
+ sb.append(',');
}
sb.append(getChild(i).toStringAST());
}
- sb.append(")");
+ sb.append(')');
return sb.toString();
}
diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/InlineMap.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/InlineMap.java
index b9aa0d5a8c7..c70759b03fe 100644
--- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/InlineMap.java
+++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/InlineMap.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2019 the original author or authors.
+ * Copyright 2002-2021 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.
@@ -140,13 +140,13 @@ public class InlineMap extends SpelNodeImpl {
int count = getChildCount();
for (int c = 0; c < count; c++) {
if (c > 0) {
- sb.append(",");
+ sb.append(',');
}
sb.append(getChild(c++).toStringAST());
- sb.append(":");
+ sb.append(':');
sb.append(getChild(c).toStringAST());
}
- sb.append("}");
+ sb.append('}');
return sb.toString();
}
diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/Operator.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/Operator.java
index 12cd2836a7c..ec31559e379 100644
--- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/Operator.java
+++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/Operator.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2019 the original author or authors.
+ * Copyright 2002-2021 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.
@@ -81,10 +81,10 @@ public abstract class Operator extends SpelNodeImpl {
StringBuilder sb = new StringBuilder("(");
sb.append(getChild(0).toStringAST());
for (int i = 1; i < getChildCount(); i++) {
- sb.append(" ").append(getOperatorName()).append(" ");
+ sb.append(' ').append(getOperatorName()).append(' ');
sb.append(getChild(i).toStringAST());
}
- sb.append(")");
+ sb.append(')');
return sb.toString();
}
diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/QualifiedIdentifier.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/QualifiedIdentifier.java
index bbf1d2d50d9..d66a4c39ce8 100644
--- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/QualifiedIdentifier.java
+++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/QualifiedIdentifier.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2019 the original author or authors.
+ * Copyright 2002-2021 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.
@@ -49,7 +49,7 @@ public class QualifiedIdentifier extends SpelNodeImpl {
for (int i = 0; i < getChildCount(); i++) {
Object value = this.children[i].getValueInternal(state).getValue();
if (i > 0 && (value == null || !value.toString().startsWith("$"))) {
- sb.append(".");
+ sb.append('.');
}
sb.append(value);
}
@@ -67,7 +67,7 @@ public class QualifiedIdentifier extends SpelNodeImpl {
else {
for (int i = 0; i < getChildCount(); i++) {
if (i > 0) {
- sb.append(".");
+ sb.append('.');
}
sb.append(getChild(i).toStringAST());
}
diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/TypeReference.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/TypeReference.java
index 8eac5d67bfe..02e8a28c302 100644
--- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/TypeReference.java
+++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/TypeReference.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2019 the original author or authors.
+ * Copyright 2002-2021 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.
@@ -90,7 +90,7 @@ public class TypeReference extends SpelNodeImpl {
for (int d = 0; d < this.dimensions; d++) {
sb.append("[]");
}
- sb.append(")");
+ sb.append(')');
return sb.toString();
}
diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/standard/Token.java b/spring-expression/src/main/java/org/springframework/expression/spel/standard/Token.java
index 21ab3e561dd..dda0ff2152c 100644
--- a/spring-expression/src/main/java/org/springframework/expression/spel/standard/Token.java
+++ b/spring-expression/src/main/java/org/springframework/expression/spel/standard/Token.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2017 the original author or authors.
+ * Copyright 2002-2021 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.
@@ -88,12 +88,12 @@ class Token {
@Override
public String toString() {
StringBuilder s = new StringBuilder();
- s.append("[").append(this.kind.toString());
+ s.append('[').append(this.kind.toString());
if (this.kind.hasPayload()) {
- s.append(":").append(this.data);
+ s.append(':').append(this.data);
}
- s.append("]");
- s.append("(").append(this.startPos).append(",").append(this.endPos).append(")");
+ s.append(']');
+ s.append('(').append(this.startPos).append(',').append(this.endPos).append(')');
return s.toString();
}
diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/AbstractExpressionTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/AbstractExpressionTests.java
index 43ae0324961..0e133522f62 100644
--- a/spring-expression/src/test/java/org/springframework/expression/spel/AbstractExpressionTests.java
+++ b/spring-expression/src/test/java/org/springframework/expression/spel/AbstractExpressionTests.java
@@ -245,22 +245,22 @@ public abstract class AbstractExpressionTests {
sb.append("int[").append(l.length).append("]{");
for (int j = 0; j < l.length; j++) {
if (j > 0) {
- sb.append(",");
+ sb.append(',');
}
sb.append(stringValueOf(l[j]));
}
- sb.append("}");
+ sb.append('}');
}
else if (primitiveType == Long.TYPE) {
long[] l = (long[]) value;
sb.append("long[").append(l.length).append("]{");
for (int j = 0; j < l.length; j++) {
if (j > 0) {
- sb.append(",");
+ sb.append(',');
}
sb.append(stringValueOf(l[j]));
}
- sb.append("}");
+ sb.append('}');
}
else {
throw new RuntimeException("Please implement support for type " + primitiveType.getName() +
@@ -272,32 +272,32 @@ public abstract class AbstractExpressionTests {
if (!isNested) {
sb.append(value.getClass().getComponentType().getName());
}
- sb.append("[").append(l.size()).append("]{");
+ sb.append('[').append(l.size()).append("]{");
int i = 0;
for (Object object : l) {
if (i > 0) {
- sb.append(",");
+ sb.append(',');
}
i++;
sb.append(stringValueOf(object, true));
}
- sb.append("}");
+ sb.append('}');
}
else {
List