Skip to content

Commit 0c75038

Browse files
committed
Polish nullability contract of StringUtils
1 parent 88e773a commit 0c75038

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

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

+2
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,7 @@ public static String deleteAny(String inString, @Nullable String charsToDelete)
516516
* @return the quoted {@code String} (for example, "'myString'"),
517517
* or {@code null} if the input was {@code null}
518518
*/
519+
@Contract("null -> null; !null -> !null")
519520
public static @Nullable String quote(@Nullable String str) {
520521
return (str != null ? "'" + str + "'" : null);
521522
}
@@ -618,6 +619,7 @@ private static String changeFirstCharacterCase(String str, boolean capitalize) {
618619
* @param path the file path (may be {@code null})
619620
* @return the extracted filename, or {@code null} if none
620621
*/
622+
@Contract("null -> null; !null -> !null")
621623
public static @Nullable String getFilename(@Nullable String path) {
622624
if (path == null) {
623625
return null;

0 commit comments

Comments
 (0)