From 841f358f13c366e4c284e9cf093d9df875a4e307 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Nicoll?= Date: Wed, 14 May 2025 14:22:26 +0200 Subject: [PATCH] Polish nullability contract of StringUtils MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Nicoll --- .../src/main/java/org/springframework/util/StringUtils.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spring-core/src/main/java/org/springframework/util/StringUtils.java b/spring-core/src/main/java/org/springframework/util/StringUtils.java index 188e1178ec2b..900fadf7b4a9 100644 --- a/spring-core/src/main/java/org/springframework/util/StringUtils.java +++ b/spring-core/src/main/java/org/springframework/util/StringUtils.java @@ -516,6 +516,7 @@ public static String deleteAny(String inString, @Nullable String charsToDelete) * @return the quoted {@code String} (for example, "'myString'"), * or {@code null} if the input was {@code null} */ + @Contract("null -> null; !null -> !null") public static @Nullable String quote(@Nullable String str) { return (str != null ? "'" + str + "'" : null); } @@ -618,6 +619,7 @@ private static String changeFirstCharacterCase(String str, boolean capitalize) { * @param path the file path (may be {@code null}) * @return the extracted filename, or {@code null} if none */ + @Contract("null -> null; !null -> !null") public static @Nullable String getFilename(@Nullable String path) { if (path == null) { return null;