diff --git a/spring-core/src/main/java/org/springframework/util/StringUtils.java b/spring-core/src/main/java/org/springframework/util/StringUtils.java index 20100bb7b9..2b0032d97c 100644 --- a/spring-core/src/main/java/org/springframework/util/StringUtils.java +++ b/spring-core/src/main/java/org/springframework/util/StringUtils.java @@ -904,7 +904,10 @@ public abstract class StringUtils { * @param array1 the first array (can be {@code null}) * @param array2 the second array (can be {@code null}) * @return the new array ({@code null} if both given arrays were {@code null}) + * @deprecated as of 4.3.15, in favor of manual merging via {@link LinkedHashSet} + * (with every entry included at most once, even entries within the first array) */ + @Deprecated @Nullable public static String[] mergeStringArrays(@Nullable String[] array1, @Nullable String[] array2) { if (ObjectUtils.isEmpty(array1)) { @@ -1021,10 +1024,9 @@ public abstract class StringUtils { /** * Take an array of strings and split each element based on the given delimiter. - * A {@code Properties} instance is then generated, with the left of the - * delimiter providing the key, and the right of the delimiter providing the value. - *

Will trim both the key and value before adding them to the - * {@code Properties} instance. + * A {@code Properties} instance is then generated, with the left of the delimiter + * providing the key, and the right of the delimiter providing the value. + *

Will trim both the key and value before adding them to the {@code Properties}. * @param array the array to process * @param delimiter to split each element using (typically the equals symbol) * @return a {@code Properties} instance representing the array contents, 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 8ccffe38a6..61e996b45d 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-2017 the original author or authors. + * Copyright 2002-2018 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. @@ -443,6 +443,7 @@ public class StringUtilsTests { } @Test + @Deprecated public void testMergeStringArrays() { String[] input1 = new String[] {"myString2"}; String[] input2 = new String[] {"myString1", "myString2"};