From 423f2215c2c542426afa6682b8240e668bb133ed Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Mon, 10 Apr 2023 17:34:04 +0200 Subject: [PATCH] Remove flaky assertion to fix build on JDK 17 Sometime between JDK 8 and JDK 17, the behavior for List::toArray() changed. Specifically, the type returned for List changed from String[] to Object[]. This commit therefore removes an assertion against this particular JDK-specific behavior. The affected test method retains additional assertions along the same lines but which are not flaky. --- .../src/test/java/org/springframework/util/ObjectUtilsTests.java | 1 - 1 file changed, 1 deletion(-) 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 eb31c4e0bf41..f6722c44eb7c 100644 --- a/spring-core/src/test/java/org/springframework/util/ObjectUtilsTests.java +++ b/spring-core/src/test/java/org/springframework/util/ObjectUtilsTests.java @@ -919,7 +919,6 @@ void nullSafeConciseToStringForLocale() { void nullSafeConciseToStringForArraysAndCollections() { List list = Arrays.asList("a", "b", "c"); assertThat(ObjectUtils.nullSafeConciseToString(new int[][] {{1, 2}, {3, 4}})).startsWith(prefix(int[][].class)); - assertThat(ObjectUtils.nullSafeConciseToString(list.toArray())).startsWith(prefix(String[].class)); assertThat(ObjectUtils.nullSafeConciseToString(list.toArray(new Object[0]))).startsWith(prefix(Object[].class)); assertThat(ObjectUtils.nullSafeConciseToString(list.toArray(new String[0]))).startsWith(prefix(String[].class)); assertThat(ObjectUtils.nullSafeConciseToString(new ArrayList<>(list))).startsWith(prefix(ArrayList.class));