From 0efeea69d0d798af9cf040f756e53f3e6b48dd9d Mon Sep 17 00:00:00 2001 From: Moritz Halbritter Date: Tue, 5 Aug 2025 09:37:56 +0200 Subject: [PATCH] Add more nullability annotations to module/spring-boot-web-server See gh-46587 --- .../main/java/org/springframework/boot/web/server/Ssl.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/module/spring-boot-web-server/src/main/java/org/springframework/boot/web/server/Ssl.java b/module/spring-boot-web-server/src/main/java/org/springframework/boot/web/server/Ssl.java index 04d6aeea794..a972b30adaf 100644 --- a/module/spring-boot-web-server/src/main/java/org/springframework/boot/web/server/Ssl.java +++ b/module/spring-boot-web-server/src/main/java/org/springframework/boot/web/server/Ssl.java @@ -457,8 +457,12 @@ public class Ssl { * @return the mapped value * @since 3.1.0 */ + @Contract("_, !null, _, _ -> !null") public static @Nullable R map(@Nullable ClientAuth clientAuth, @Nullable R none, R want, R need) { - return switch ((clientAuth != null) ? clientAuth : NONE) { + if (clientAuth == null) { + return none; + } + return switch (clientAuth) { case NONE -> none; case WANT -> want; case NEED -> need;