diff --git a/framework-platform/framework-platform.gradle b/framework-platform/framework-platform.gradle index 2320755c6a..5f4d0d70c0 100644 --- a/framework-platform/framework-platform.gradle +++ b/framework-platform/framework-platform.gradle @@ -11,7 +11,7 @@ dependencies { api(platform("io.micrometer:micrometer-bom:1.10.8")) api(platform("io.netty:netty-bom:4.1.93.Final")) api(platform("io.netty:netty5-bom:5.0.0.Alpha5")) - api(platform("io.projectreactor:reactor-bom:2022.0.7")) + api(platform("io.projectreactor:reactor-bom:2022.0.8")) api(platform("io.rsocket:rsocket-bom:1.1.3")) api(platform("org.apache.groovy:groovy-bom:4.0.12")) api(platform("org.apache.logging.log4j:log4j-bom:2.20.0")) diff --git a/spring-core/src/main/java/org/springframework/util/ObjectUtils.java b/spring-core/src/main/java/org/springframework/util/ObjectUtils.java index 42e0465595..fd4fb57588 100644 --- a/spring-core/src/main/java/org/springframework/util/ObjectUtils.java +++ b/spring-core/src/main/java/org/springframework/util/ObjectUtils.java @@ -27,6 +27,7 @@ import java.util.Locale; import java.util.Map; import java.util.Optional; import java.util.StringJoiner; +import java.util.UUID; import org.springframework.lang.Nullable; @@ -903,14 +904,15 @@ public abstract class ObjectUtils { *
In the context of this method, a simple type is any of the following: - * a primitive wrapper (excluding {@link Void}), an {@link Enum}, a {@link Number}, - * a {@link Date}, a {@link Temporal}, a {@link URI}, a {@link URL}, or a {@link Locale}. + *
In the context of this method, a simple value type is any of the following: + * a primitive wrapper (excluding {@code Void}), an {@code Enum}, a {@code Number}, + * a {@code Date}, a {@code Temporal}, a {@code UUID}, a {@code URI}, a {@code URL}, + * or a {@code Locale}. * @param obj the object to build a string representation for * @return a concise string representation of the supplied object * @since 5.3.27 @@ -938,13 +940,7 @@ public abstract class ObjectUtils { } /** - * Copy of {@link org.springframework.beans.BeanUtils#isSimpleValueType(Class)}. - *
Check if the given type represents a "simple" value type: a primitive or - * primitive wrapper, an enum, a String or other CharSequence, a Number, a - * Date, a Temporal, a URI, a URL, a Locale, or a Class. - *
{@code Void} and {@code void} are not considered simple value types. - * @param type the type to check - * @return whether the given type represents a "simple" value type + * Derived from {@link org.springframework.beans.BeanUtils#isSimpleValueType}. */ private static boolean isSimpleValueType(Class> type) { return (Void.class != type && void.class != type && @@ -954,6 +950,7 @@ public abstract class ObjectUtils { Number.class.isAssignableFrom(type) || Date.class.isAssignableFrom(type) || Temporal.class.isAssignableFrom(type) || + UUID.class.isAssignableFrom(type) || URI.class == type || URL.class == type || Locale.class == type || diff --git a/spring-core/src/test/java/org/springframework/util/ObjectUtilsTests.java b/spring-core/src/test/java/org/springframework/util/ObjectUtilsTests.java index 7f7038df93..3ec2373bb8 100644 --- a/spring-core/src/test/java/org/springframework/util/ObjectUtilsTests.java +++ b/spring-core/src/test/java/org/springframework/util/ObjectUtilsTests.java @@ -29,6 +29,7 @@ import java.util.HashSet; import java.util.List; import java.util.Locale; import java.util.Set; +import java.util.UUID; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; @@ -800,6 +801,17 @@ class ObjectUtilsTests { .withMessage("Constant [bogus] does not exist in enum type org.springframework.util.ObjectUtilsTests$Tropes"); } + + private static void assertEqualHashCodes(int expected, Object array) { + int actual = ObjectUtils.nullSafeHashCode(array); + assertThat(actual).isEqualTo(expected); + assertThat(array.hashCode()).isNotEqualTo(actual); + } + + + enum Tropes {FOO, BAR, baz} + + @Nested class NullSafeConciseToStringTests { @@ -861,7 +873,13 @@ class ObjectUtilsTests { } @Test - void nullSafeConciseToStringForUri() { + void nullSafeConciseToStringForUUID() { + UUID id = UUID.randomUUID(); + assertThat(ObjectUtils.nullSafeConciseToString(id)).isEqualTo(id.toString()); + } + + @Test + void nullSafeConciseToStringForURI() { String uri = "https://www.example.com/?foo=1&bar=2&baz=3"; assertThat(ObjectUtils.nullSafeConciseToString(URI.create(uri))).isEqualTo(uri); @@ -873,7 +891,7 @@ class ObjectUtilsTests { } @Test - void nullSafeConciseToStringForUrl() throws Exception { + void nullSafeConciseToStringForURL() throws Exception { String url = "https://www.example.com/?foo=1&bar=2&baz=3"; assertThat(ObjectUtils.nullSafeConciseToString(new URL(url))).isEqualTo(url); @@ -925,17 +943,6 @@ class ObjectUtilsTests { private static String prefix(Class> clazz) { return clazz.getTypeName() + "@"; } - } - - private static void assertEqualHashCodes(int expected, Object array) { - int actual = ObjectUtils.nullSafeHashCode(array); - assertThat(actual).isEqualTo(expected); - assertThat(array.hashCode()).isNotEqualTo(actual); - } - - - enum Tropes {FOO, BAR, baz} - }