Add nullability contract to PasswordEncoder#encode

Signed-off-by: Stefano Cordio <stefano.cordio@gmail.com>
This commit is contained in:
Stefano Cordio 2025-12-18 12:27:18 +01:00 committed by Rob Winch
parent fe138d6434
commit a612522ecd

View File

@ -17,6 +17,7 @@
package org.springframework.security.crypto.password;
import org.jspecify.annotations.Nullable;
import org.springframework.lang.Contract;
/**
* Service interface for encoding passwords.
@ -36,6 +37,7 @@ public interface PasswordEncoder {
* @return A non-null encoded password, unless the rawPassword was null in which case
* the result must be null.
*/
@Contract("null -> null; !null -> !null")
@Nullable String encode(@Nullable CharSequence rawPassword);
/**