diff --git a/spring-aop/src/test/java/org/springframework/aop/interceptor/CustomizableTraceInterceptorTests.java b/spring-aop/src/test/java/org/springframework/aop/interceptor/CustomizableTraceInterceptorTests.java index b98acc38e94d..ebf44f27fcdd 100644 --- a/spring-aop/src/test/java/org/springframework/aop/interceptor/CustomizableTraceInterceptorTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/interceptor/CustomizableTraceInterceptorTests.java @@ -143,13 +143,13 @@ public void testSunnyDayPathLogsCorrectlyWithPrettyMuchAllPlaceholdersMatching() given(log.isTraceEnabled()).willReturn(true); CustomizableTraceInterceptor interceptor = new StubCustomizableTraceInterceptor(log); - interceptor.setEnterMessage(new StringBuffer() + interceptor.setEnterMessage(new StringBuilder() .append("Entering the '").append(CustomizableTraceInterceptor.PLACEHOLDER_METHOD_NAME) .append("' method of the [").append(CustomizableTraceInterceptor.PLACEHOLDER_TARGET_CLASS_NAME) .append("] class with the following args (").append(CustomizableTraceInterceptor.PLACEHOLDER_ARGUMENTS) .append(") and arg types (").append(CustomizableTraceInterceptor.PLACEHOLDER_ARGUMENT_TYPES) .append(").").toString()); - interceptor.setExitMessage(new StringBuffer() + interceptor.setExitMessage(new StringBuilder() .append("Exiting the '").append(CustomizableTraceInterceptor.PLACEHOLDER_METHOD_NAME) .append("' method of the [").append(CustomizableTraceInterceptor.PLACEHOLDER_TARGET_CLASS_SHORT_NAME) .append("] class with the following args (").append(CustomizableTraceInterceptor.PLACEHOLDER_ARGUMENTS) diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTestTypes.java b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTestTypes.java index 0d846d9d1243..01c0f5413df3 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTestTypes.java +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTestTypes.java @@ -589,7 +589,7 @@ class ReverseMethodReplacer implements MethodReplacer, Serializable { @Override public Object reimplement(Object obj, Method method, Object[] args) throws Throwable { String s = (String) args[0]; - return new StringBuffer(s).reverse().toString(); + return new StringBuilder(s).reverse().toString(); } } diff --git a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests.java b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests.java index edf72fdcf2b3..a1e3f81940aa 100644 --- a/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests.java +++ b/spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests.java @@ -1324,7 +1324,7 @@ void replaceMethodOverrideWithSetterInjection() { // Now test replace String s = "this is not a palindrome"; - String reverse = new StringBuffer(s).reverse().toString(); + String reverse = new StringBuilder(s).reverse().toString(); assertThat(oom.replaceMe(s)).as("Should have overridden to reverse, not echo").isEqualTo(reverse); assertThat(oom.replaceMe()).as("Should have overridden no-arg overloaded replaceMe method to return fixed value").isEqualTo(FixedMethodReplacer.VALUE); @@ -1380,7 +1380,7 @@ void serializableMethodReplacerAndSuperclass() throws IOException { reader.loadBeanDefinitions(DELEGATION_OVERRIDES_CONTEXT); SerializableMethodReplacerCandidate s = (SerializableMethodReplacerCandidate) xbf.getBean("serializableReplacer"); String forwards = "this is forwards"; - String backwards = new StringBuffer(forwards).reverse().toString(); + String backwards = new StringBuilder(forwards).reverse().toString(); assertThat(s.replaceMe(forwards)).isEqualTo(backwards); // SPR-356: lookup methods & method replacers are not serializable. assertThat(SerializationTestUtils.isSerializable(s)).as("Lookup methods and method replacers are not meant to be serializable.").isFalse(); diff --git a/spring-context/src/test/java/org/springframework/scripting/MessengerScrambler.java b/spring-context/src/test/java/org/springframework/scripting/MessengerScrambler.java index fba76773e167..36320d0c1597 100644 --- a/spring-context/src/test/java/org/springframework/scripting/MessengerScrambler.java +++ b/spring-context/src/test/java/org/springframework/scripting/MessengerScrambler.java @@ -28,7 +28,7 @@ public class MessengerScrambler { public String scramble(ProceedingJoinPoint pjp) throws Throwable { String message = (String) pjp.proceed(); - return new StringBuffer(message).reverse().toString(); + return new StringBuilder(message).reverse().toString(); } } diff --git a/spring-core/src/main/java/org/springframework/cglib/core/ReflectUtils.java b/spring-core/src/main/java/org/springframework/cglib/core/ReflectUtils.java index 1af56bd8366f..a8f4cb5da7d7 100644 --- a/spring-core/src/main/java/org/springframework/cglib/core/ReflectUtils.java +++ b/spring-core/src/main/java/org/springframework/cglib/core/ReflectUtils.java @@ -260,7 +260,7 @@ private static Class getClass(String className, ClassLoader loader, String[] pac while ((index = className.indexOf("[]", index) + 1) > 0) { dimensions++; } - StringBuffer brackets = new StringBuffer(className.length() - dimensions); + StringBuilder brackets = new StringBuilder(className.length() - dimensions); for (int i = 0; i < dimensions; i++) { brackets.append('['); }