From dc242df53378bfcc51fcdbe59e205235845d975d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deleuze?= Date: Tue, 9 Apr 2024 13:35:49 +0200 Subject: [PATCH] Prevent compilation warnings with `@Nullable` This commit replaces `@Nonnull(when = When.MAYBE)` meta-annotation in `org.springframework.lang.Nullable` by `@CheckForNull` in order to prevent `unknown enum constant When.MAYBE` compilation warnings. Closes gh-27183 --- .../src/main/java/org/springframework/lang/Nullable.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/spring-core/src/main/java/org/springframework/lang/Nullable.java b/spring-core/src/main/java/org/springframework/lang/Nullable.java index 324d28899a98..a07eec0b7c07 100644 --- a/spring-core/src/main/java/org/springframework/lang/Nullable.java +++ b/spring-core/src/main/java/org/springframework/lang/Nullable.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 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. @@ -22,9 +22,8 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import javax.annotation.Nonnull; +import javax.annotation.CheckForNull; import javax.annotation.meta.TypeQualifierNickname; -import javax.annotation.meta.When; /** * A common Spring annotation to declare that annotated elements can be {@code null} @@ -50,7 +49,7 @@ @Target({ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) @Documented -@Nonnull(when = When.MAYBE) +@CheckForNull @TypeQualifierNickname public @interface Nullable { }