Skip to content

Commit c599775

Browse files
ngocnhan-tran1996sdeleuze
authored andcommitted
Refine nullability of Assert#noNullElements
Closes gh-35868 Signed-off-by: Tran Ngoc Nhan <[email protected]>
1 parent 4bc97ad commit c599775

File tree

1 file changed

+4
-4
lines changed
  • spring-core/src/main/java/org/springframework/util

1 file changed

+4
-4
lines changed

spring-core/src/main/java/org/springframework/util/Assert.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ public static void notEmpty(Object @Nullable [] array, Supplier<String> messageS
352352
* @param message the exception message to use if the assertion fails
353353
* @throws IllegalArgumentException if the object array contains a {@code null} element
354354
*/
355-
public static void noNullElements(Object @Nullable [] array, String message) {
355+
public static void noNullElements(@Nullable Object @Nullable [] array, String message) {
356356
if (array != null) {
357357
for (Object element : array) {
358358
if (element == null) {
@@ -374,7 +374,7 @@ public static void noNullElements(Object @Nullable [] array, String message) {
374374
* @throws IllegalArgumentException if the object array contains a {@code null} element
375375
* @since 5.0
376376
*/
377-
public static void noNullElements(Object @Nullable [] array, Supplier<String> messageSupplier) {
377+
public static void noNullElements(@Nullable Object @Nullable [] array, Supplier<String> messageSupplier) {
378378
if (array != null) {
379379
for (Object element : array) {
380380
if (element == null) {
@@ -429,7 +429,7 @@ public static void notEmpty(@Nullable Collection<?> collection, Supplier<String>
429429
* @throws IllegalArgumentException if the collection contains a {@code null} element
430430
* @since 5.2
431431
*/
432-
public static void noNullElements(@Nullable Collection<?> collection, String message) {
432+
public static void noNullElements(@Nullable Collection<? extends @Nullable Object> collection, String message) {
433433
if (collection != null) {
434434
for (Object element : collection) {
435435
if (element == null) {
@@ -451,7 +451,7 @@ public static void noNullElements(@Nullable Collection<?> collection, String mes
451451
* @throws IllegalArgumentException if the collection contains a {@code null} element
452452
* @since 5.2
453453
*/
454-
public static void noNullElements(@Nullable Collection<?> collection, Supplier<String> messageSupplier) {
454+
public static void noNullElements(@Nullable Collection<? extends @Nullable Object> collection, Supplier<String> messageSupplier) {
455455
if (collection != null) {
456456
for (Object element : collection) {
457457
if (element == null) {

0 commit comments

Comments
 (0)