Skip to content

Commit 70415b1

Browse files
committed
Merge branch '5.3.x'
2 parents 874077d + 59c7bb1 commit 70415b1

File tree

11 files changed

+56
-51
lines changed

11 files changed

+56
-51
lines changed

spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcut.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2021 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -378,7 +378,7 @@ public boolean matches(Method method, Class<?> targetClass, Object... args) {
378378
}
379379
catch (Throwable ex) {
380380
if (logger.isDebugEnabled()) {
381-
logger.debug("Failed to evaluate join point for arguments " + Arrays.asList(args) +
381+
logger.debug("Failed to evaluate join point for arguments " + Arrays.toString(args) +
382382
" - falling back to non-match", ex);
383383
}
384384
return false;

spring-aop/src/main/java/org/springframework/aop/framework/ProxyFactoryBean.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ private synchronized void initializeAdvisorChain() throws AopConfigException, Be
424424
if (!this.advisorChainInitialized && !ObjectUtils.isEmpty(this.interceptorNames)) {
425425
if (this.beanFactory == null) {
426426
throw new IllegalStateException("No BeanFactory available anymore (probably due to serialization) " +
427-
"- cannot resolve interceptor names " + Arrays.asList(this.interceptorNames));
427+
"- cannot resolve interceptor names " + Arrays.toString(this.interceptorNames));
428428
}
429429

430430
// Globals can't be last unless we specified a targetSource using the property...

spring-beans/src/main/java/org/springframework/beans/factory/support/ManagedList.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
package org.springframework.beans.factory.support;
1818

1919
import java.util.ArrayList;
20-
import java.util.Arrays;
20+
import java.util.Collections;
2121
import java.util.List;
2222

2323
import org.springframework.beans.BeanMetadataElement;
@@ -31,6 +31,8 @@
3131
* @author Rod Johnson
3232
* @author Rob Harrop
3333
* @author Juergen Hoeller
34+
* @author Stephane Nicoll
35+
* @author Sam Brannen
3436
* @since 27.05.2003
3537
* @param <E> the element type
3638
*/
@@ -55,16 +57,16 @@ public ManagedList(int initialCapacity) {
5557

5658

5759
/**
58-
* Return a new instance containing an arbitrary number of elements.
60+
* Create a new instance containing an arbitrary number of elements.
5961
* @param elements the elements to be contained in the list
6062
* @param <E> the {@code List}'s element type
61-
* @return a {@code List} containing the specified elements
63+
* @return a {@code ManagedList} containing the specified elements
6264
* @since 5.3.16
6365
*/
64-
@SuppressWarnings("unchecked")
66+
@SafeVarargs
6567
public static <E> ManagedList<E> of(E... elements) {
6668
ManagedList<E> list = new ManagedList<>();
67-
list.addAll(Arrays.asList(elements));
69+
Collections.addAll(list, elements);
6870
return list;
6971
}
7072

spring-beans/src/main/java/org/springframework/beans/factory/support/ManagedSet.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package org.springframework.beans.factory.support;
1818

19-
import java.util.Arrays;
19+
import java.util.Collections;
2020
import java.util.LinkedHashSet;
2121
import java.util.Set;
2222

@@ -30,6 +30,8 @@
3030
*
3131
* @author Juergen Hoeller
3232
* @author Rob Harrop
33+
* @author Stephane Nicoll
34+
* @author Sam Brannen
3335
* @since 21.01.2004
3436
* @param <E> the element type
3537
*/
@@ -54,16 +56,16 @@ public ManagedSet(int initialCapacity) {
5456

5557

5658
/**
57-
* Return a new instance containing an arbitrary number of elements.
59+
* Create a new instance containing an arbitrary number of elements.
5860
* @param elements the elements to be contained in the set
5961
* @param <E> the {@code Set}'s element type
60-
* @return a {@code Set} containing the specified elements
62+
* @return a {@code ManagedSet} containing the specified elements
6163
* @since 5.3.16
6264
*/
63-
@SuppressWarnings("unchecked")
65+
@SafeVarargs
6466
public static <E> ManagedSet<E> of(E... elements) {
6567
ManagedSet<E> set = new ManagedSet<>();
66-
set.addAll(Arrays.asList(elements));
68+
Collections.addAll(set, elements);
6769
return set;
6870
}
6971

spring-beans/src/test/java/org/springframework/beans/factory/support/ManagedListTests.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,61 +25,61 @@
2525
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
2626

2727
/**
28+
* Unit tests for {@link ManagedList}.
29+
*
2830
* @author Rick Evans
2931
* @author Juergen Hoeller
3032
* @author Sam Brannen
3133
*/
3234
@SuppressWarnings({ "rawtypes", "unchecked" })
33-
public class ManagedListTests {
35+
class ManagedListTests {
3436

3537
@Test
36-
public void mergeSunnyDay() {
38+
void mergeSunnyDay() {
3739
ManagedList parent = ManagedList.of("one", "two");
3840
ManagedList child = ManagedList.of("three");
3941
child.setMergeEnabled(true);
4042
List mergedList = child.merge(parent);
41-
assertThat(mergedList.size()).as("merge() obviously did not work.").isEqualTo(3);
43+
assertThat(mergedList).as("merge() obviously did not work.").containsExactly("one", "two", "three");
4244
}
4345

4446
@Test
45-
public void mergeWithNullParent() {
47+
void mergeWithNullParent() {
4648
ManagedList child = ManagedList.of("one");
4749
child.setMergeEnabled(true);
4850
assertThat(child.merge(null)).isSameAs(child);
4951
}
5052

5153
@Test
52-
public void mergeNotAllowedWhenMergeNotEnabled() {
54+
void mergeNotAllowedWhenMergeNotEnabled() {
5355
ManagedList child = new ManagedList();
54-
assertThatIllegalStateException().isThrownBy(() ->
55-
child.merge(null));
56+
assertThatIllegalStateException().isThrownBy(() -> child.merge(null));
5657
}
5758

5859
@Test
59-
public void mergeWithNonCompatibleParentType() {
60+
void mergeWithIncompatibleParentType() {
6061
ManagedList child = ManagedList.of("one");
6162
child.setMergeEnabled(true);
62-
assertThatIllegalArgumentException().isThrownBy(() ->
63-
child.merge("hello"));
63+
assertThatIllegalArgumentException().isThrownBy(() -> child.merge("hello"));
6464
}
6565

6666
@Test
67-
public void mergeEmptyChild() {
67+
void mergeEmptyChild() {
6868
ManagedList parent = ManagedList.of("one", "two");
6969
ManagedList child = new ManagedList();
7070
child.setMergeEnabled(true);
7171
List mergedList = child.merge(parent);
72-
assertThat(mergedList.size()).as("merge() obviously did not work.").isEqualTo(2);
72+
assertThat(mergedList).as("merge() obviously did not work.").containsExactly("one", "two");
7373
}
7474

7575
@Test
76-
public void mergeChildValuesOverrideTheParents() {
76+
void mergedChildValuesDoNotOverrideTheParents() {
7777
// doesn't make much sense in the context of a list...
7878
ManagedList parent = ManagedList.of("one", "two");
7979
ManagedList child = ManagedList.of("one");
8080
child.setMergeEnabled(true);
8181
List mergedList = child.merge(parent);
82-
assertThat(mergedList.size()).as("merge() obviously did not work.").isEqualTo(3);
82+
assertThat(mergedList).as("merge() obviously did not work.").containsExactly("one", "two", "one");
8383
}
8484

8585
}

spring-beans/src/test/java/org/springframework/beans/factory/support/ManagedSetTests.java

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,61 +25,62 @@
2525
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
2626

2727
/**
28+
* Unit tests for {@link ManagedSet}.
29+
*
2830
* @author Rick Evans
2931
* @author Juergen Hoeller
3032
* @author Sam Brannen
3133
*/
3234
@SuppressWarnings({ "rawtypes", "unchecked" })
33-
public class ManagedSetTests {
35+
class ManagedSetTests {
3436

3537
@Test
36-
public void mergeSunnyDay() {
38+
void mergeSunnyDay() {
3739
ManagedSet parent = ManagedSet.of("one", "two");
3840
ManagedSet child = ManagedSet.of("three");
3941
child.add("three");
42+
child.add("four");
4043
child.setMergeEnabled(true);
4144
Set mergedSet = child.merge(parent);
42-
assertThat(mergedSet.size()).as("merge() obviously did not work.").isEqualTo(3);
45+
assertThat(mergedSet).as("merge() obviously did not work.").containsExactly("one", "two", "three", "four");
4346
}
4447

4548
@Test
46-
public void mergeWithNullParent() {
49+
void mergeWithNullParent() {
4750
ManagedSet child = ManagedSet.of("one");
4851
child.setMergeEnabled(true);
4952
assertThat(child.merge(null)).isSameAs(child);
5053
}
5154

5255
@Test
53-
public void mergeNotAllowedWhenMergeNotEnabled() {
54-
assertThatIllegalStateException().isThrownBy(() ->
55-
new ManagedSet().merge(null));
56+
void mergeNotAllowedWhenMergeNotEnabled() {
57+
assertThatIllegalStateException().isThrownBy(() -> new ManagedSet().merge(null));
5658
}
5759

5860
@Test
59-
public void mergeWithNonCompatibleParentType() {
61+
void mergeWithNonCompatibleParentType() {
6062
ManagedSet child = ManagedSet.of("one");
6163
child.setMergeEnabled(true);
62-
assertThatIllegalArgumentException().isThrownBy(() ->
63-
child.merge("hello"));
64+
assertThatIllegalArgumentException().isThrownBy(() -> child.merge("hello"));
6465
}
6566

6667
@Test
67-
public void mergeEmptyChild() {
68+
void mergeEmptyChild() {
6869
ManagedSet parent = ManagedSet.of("one", "two");
6970
ManagedSet child = new ManagedSet();
7071
child.setMergeEnabled(true);
7172
Set mergedSet = child.merge(parent);
72-
assertThat(mergedSet.size()).as("merge() obviously did not work.").isEqualTo(2);
73+
assertThat(mergedSet).as("merge() obviously did not work.").containsExactly("one", "two");
7374
}
7475

7576
@Test
76-
public void mergeChildValuesOverrideTheParents() {
77+
void mergeChildValuesOverrideTheParents() {
7778
// asserts that the set contract is not violated during a merge() operation...
7879
ManagedSet parent = ManagedSet.of("one", "two");
7980
ManagedSet child = ManagedSet.of("one");
8081
child.setMergeEnabled(true);
8182
Set mergedSet = child.merge(parent);
82-
assertThat(mergedSet.size()).as("merge() obviously did not work.").isEqualTo(2);
83+
assertThat(mergedSet).as("merge() obviously did not work.").containsExactly("one", "two");
8384
}
8485

8586
}

spring-context/src/main/java/org/springframework/jmx/access/NotificationListenerRegistrar.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -143,7 +143,7 @@ public void prepare() {
143143
this.actualObjectNames = getResolvedObjectNames();
144144
if (this.actualObjectNames != null) {
145145
if (logger.isDebugEnabled()) {
146-
logger.debug("Registering NotificationListener for MBeans " + Arrays.asList(this.actualObjectNames));
146+
logger.debug("Registering NotificationListener for MBeans " + Arrays.toString(this.actualObjectNames));
147147
}
148148
for (ObjectName actualObjectName : this.actualObjectNames) {
149149
this.server.addNotificationListener(

spring-core/src/main/java/org/springframework/core/env/AbstractEnvironment.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2021 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -297,7 +297,7 @@ protected String doGetActiveProfilesProperty() {
297297
public void setActiveProfiles(String... profiles) {
298298
Assert.notNull(profiles, "Profile array must not be null");
299299
if (logger.isDebugEnabled()) {
300-
logger.debug("Activating profiles " + Arrays.asList(profiles));
300+
logger.debug("Activating profiles " + Arrays.toString(profiles));
301301
}
302302
synchronized (this.activeProfiles) {
303303
this.activeProfiles.clear();

spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/AbstractJdbcInsert.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2021 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -451,7 +451,7 @@ private KeyHolder executeInsertAndReturnKeyHolderInternal(final List<?> values)
451451
if (getGeneratedKeyNames().length > 1) {
452452
throw new InvalidDataAccessApiUsageException(
453453
"Current database only supports retrieving the key for a single column. There are " +
454-
getGeneratedKeyNames().length + " columns specified: " + Arrays.asList(getGeneratedKeyNames()));
454+
getGeneratedKeyNames().length + " columns specified: " + Arrays.toString(getGeneratedKeyNames()));
455455
}
456456

457457
Assert.state(getTableName() != null, "No table name set");

spring-websocket/src/main/java/org/springframework/web/socket/server/standard/SpringConfigurator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -117,7 +117,7 @@ private String getBeanNameByType(WebApplicationContext wac, Class<?> endpointCla
117117
beanNamesByType.put(endpointClass, NO_VALUE);
118118
if (names.length > 1) {
119119
throw new IllegalStateException("Found multiple @ServerEndpoint's of type [" +
120-
endpointClass.getName() + "]: bean names " + Arrays.asList(names));
120+
endpointClass.getName() + "]: bean names " + Arrays.toString(names));
121121
}
122122
}
123123
}

spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/handler/AbstractHttpReceivingTransportHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -83,7 +83,7 @@ protected void handleRequestInternal(ServerHttpRequest request, ServerHttpRespon
8383
return;
8484
}
8585
if (logger.isTraceEnabled()) {
86-
logger.trace("Received message(s): " + Arrays.asList(messages));
86+
logger.trace("Received message(s): " + Arrays.toString(messages));
8787
}
8888
response.setStatusCode(getResponseStatus());
8989
response.getHeaders().setContentType(new MediaType("text", "plain", StandardCharsets.UTF_8));

0 commit comments

Comments
 (0)