Skip to content

Commit a612522

Browse files
scordiorwinch
authored andcommitted
Add nullability contract to PasswordEncoder#encode
Signed-off-by: Stefano Cordio <stefano.cordio@gmail.com>
1 parent fe138d6 commit a612522

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

crypto/src/main/java/org/springframework/security/crypto/password/PasswordEncoder.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package org.springframework.security.crypto.password;
1818

1919
import org.jspecify.annotations.Nullable;
20+
import org.springframework.lang.Contract;
2021

2122
/**
2223
* Service interface for encoding passwords.
@@ -36,6 +37,7 @@ public interface PasswordEncoder {
3637
* @return A non-null encoded password, unless the rawPassword was null in which case
3738
* the result must be null.
3839
*/
40+
@Contract("null -> null; !null -> !null")
3941
@Nullable String encode(@Nullable CharSequence rawPassword);
4042

4143
/**

0 commit comments

Comments
 (0)