Skip to content

Commit d656397

Browse files
committed
Complete nullability annotations in remaining equals methods
In this commit, we'll finally add nullability annotations to the equals method for consistency with other projects. We've already done this, but we recently added jspecify support to new modules. Signed-off-by: Andrey Litvitski <andrey1010102008@gmail.com>
1 parent 5b8d818 commit d656397

8 files changed

Lines changed: 17 additions & 9 deletions

File tree

oauth2/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/OAuth2Authorization.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ public Map<String, Object> getAttributes() {
196196
}
197197

198198
@Override
199-
public boolean equals(Object obj) {
199+
public boolean equals(@Nullable Object obj) {
200200
if (this == obj) {
201201
return true;
202202
}
@@ -363,7 +363,7 @@ protected static Map<String, Object> defaultMetadata() {
363363
}
364364

365365
@Override
366-
public boolean equals(Object obj) {
366+
public boolean equals(@Nullable Object obj) {
367367
if (this == obj) {
368368
return true;
369369
}

oauth2/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/OAuth2AuthorizationConsent.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
import java.util.Set;
2525
import java.util.function.Consumer;
2626

27+
import org.jspecify.annotations.Nullable;
28+
2729
import org.springframework.security.core.GrantedAuthority;
2830
import org.springframework.security.core.authority.SimpleGrantedAuthority;
2931
import org.springframework.security.oauth2.server.authorization.client.RegisteredClient;
@@ -107,7 +109,7 @@ public Set<String> getScopes() {
107109
}
108110

109111
@Override
110-
public boolean equals(Object obj) {
112+
public boolean equals(@Nullable Object obj) {
111113
if (this == obj) {
112114
return true;
113115
}

oauth2/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/OAuth2TokenType.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import java.io.Serial;
2020
import java.io.Serializable;
2121

22+
import org.jspecify.annotations.Nullable;
23+
2224
import org.springframework.util.Assert;
2325

2426
/**
@@ -64,7 +66,7 @@ public String getValue() {
6466
}
6567

6668
@Override
67-
public boolean equals(Object obj) {
69+
public boolean equals(@Nullable Object obj) {
6870
if (this == obj) {
6971
return true;
7072
}

oauth2/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2TokenExchangeActor.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
import java.util.Map;
2323
import java.util.Objects;
2424

25+
import org.jspecify.annotations.Nullable;
26+
2527
import org.springframework.security.oauth2.core.ClaimAccessor;
2628
import org.springframework.security.oauth2.server.authorization.token.OAuth2TokenClaimNames;
2729
import org.springframework.util.Assert;
@@ -65,7 +67,7 @@ public String getSubject() {
6567
}
6668

6769
@Override
68-
public boolean equals(Object obj) {
70+
public boolean equals(@Nullable Object obj) {
6971
if (!(obj instanceof OAuth2TokenExchangeActor other)) {
7072
return false;
7173
}

oauth2/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/client/RegisteredClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ public TokenSettings getTokenSettings() {
203203
}
204204

205205
@Override
206-
public boolean equals(Object obj) {
206+
public boolean equals(@Nullable Object obj) {
207207
if (this == obj) {
208208
return true;
209209
}

oauth2/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/settings/AbstractSettings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public Map<String, Object> getSettings() {
6767
}
6868

6969
@Override
70-
public boolean equals(Object obj) {
70+
public boolean equals(@Nullable Object obj) {
7171
if (this == obj) {
7272
return true;
7373
}

oauth2/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/settings/OAuth2TokenFormat.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import java.io.Serial;
2020
import java.io.Serializable;
2121

22+
import org.jspecify.annotations.Nullable;
23+
2224
import org.springframework.util.Assert;
2325

2426
/**
@@ -65,7 +67,7 @@ public String getValue() {
6567
}
6668

6769
@Override
68-
public boolean equals(Object obj) {
70+
public boolean equals(@Nullable Object obj) {
6971
if (this == obj) {
7072
return true;
7173
}

webauthn/src/main/java/org/springframework/security/web/webauthn/api/ImmutablePublicKeyCredentialUserEntity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public static PublicKeyCredentialUserEntityBuilder builder() {
137137
}
138138

139139
@Override
140-
public boolean equals(Object obj) {
140+
public boolean equals(@Nullable Object obj) {
141141
if (this == obj) {
142142
return true;
143143
}

0 commit comments

Comments
 (0)