Polish nullability contract of StringUtils

Signed-off-by: Stéphane Nicoll <stephane.nicoll@broadcom.com>
This commit is contained in:
Stéphane Nicoll 2025-05-14 14:22:26 +02:00
parent 88e773ae24
commit 841f358f13
1 changed files with 2 additions and 0 deletions

View File

@ -516,6 +516,7 @@ public abstract class StringUtils {
* @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 @@ public abstract class StringUtils {
* @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;