Skip to content

Commit 6f68fe8

Browse files
christophstroblmp911de
authored andcommitted
Add Nullable annotation to parameter of overridden equals method.
Closes: #2196 Original pull request: #2197
1 parent a9bfcfe commit 6f68fe8

File tree

10 files changed

+21
-14
lines changed

10 files changed

+21
-14
lines changed

spring-data-rest-core/src/main/java/org/springframework/data/rest/core/Path.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import java.util.regex.Pattern;
1919

20+
import org.springframework.lang.Nullable;
2021
import org.springframework.util.StringUtils;
2122

2223
/**
@@ -103,7 +104,7 @@ public String toString() {
103104
}
104105

105106
@Override
106-
public boolean equals(Object obj) {
107+
public boolean equals(@Nullable Object obj) {
107108

108109
if (this == obj) {
109110
return true;

spring-data-rest-core/src/main/java/org/springframework/data/rest/core/config/EntityLookupConfiguration.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.springframework.data.rest.core.support.EntityLookup;
3030
import org.springframework.data.util.MethodInvocationRecorder;
3131
import org.springframework.data.util.StreamUtils;
32+
import org.springframework.lang.Nullable;
3233
import org.springframework.util.Assert;
3334

3435
/**
@@ -238,7 +239,7 @@ public Lookup<R, ID> getLookup() {
238239
}
239240

240241
@Override
241-
public boolean equals(final java.lang.Object o) {
242+
public boolean equals(@Nullable final java.lang.Object o) {
242243

243244
if (o == this) {
244245
return true;

spring-data-rest-core/src/main/java/org/springframework/data/rest/core/config/ProjectionDefinitionConfiguration.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.springframework.core.annotation.AnnotationUtils;
2525
import org.springframework.data.rest.core.projection.ProjectionDefinitions;
2626
import org.springframework.data.util.ProxyUtils;
27+
import org.springframework.lang.Nullable;
2728
import org.springframework.util.Assert;
2829
import org.springframework.util.StringUtils;
2930

@@ -225,7 +226,7 @@ public String getName() {
225226
}
226227

227228
@Override
228-
public boolean equals(Object o) {
229+
public boolean equals(@Nullable Object o) {
229230

230231
if (o == this) {
231232
return true;

spring-data-rest-core/src/main/java/org/springframework/data/rest/core/event/AnnotatedEventHandlerInvoker.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import org.springframework.core.annotation.AnnotationUtils;
3434
import org.springframework.data.rest.core.annotation.*;
3535
import org.springframework.data.util.ProxyUtils;
36+
import org.springframework.lang.Nullable;
3637
import org.springframework.util.Assert;
3738
import org.springframework.util.ClassUtils;
3839
import org.springframework.util.LinkedMultiValueMap;
@@ -191,7 +192,7 @@ public int compareTo(EventHandlerMethod o) {
191192
}
192193

193194
@Override
194-
public boolean equals(final java.lang.Object o) {
195+
public boolean equals(@Nullable final java.lang.Object o) {
195196

196197
if (o == this) {
197198
return true;

spring-data-rest-core/src/main/java/org/springframework/data/rest/core/mapping/ParameterMetadata.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import org.springframework.core.MethodParameter;
1919
import org.springframework.data.rest.core.annotation.Description;
2020
import org.springframework.hateoas.LinkRelation;
21+
import org.springframework.lang.Nullable;
2122
import org.springframework.util.Assert;
2223

2324
/**
@@ -71,7 +72,7 @@ public ResourceDescription getDescription() {
7172
}
7273

7374
@Override
74-
public boolean equals(Object obj) {
75+
public boolean equals(@Nullable Object obj) {
7576

7677
if (this == obj) {
7778
return true;

spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/config/DelegatingHandlerMapping.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public HandlerSelectionResult(HttpServletRequest request, HandlerMapping mapping
173173
}
174174

175175
@Override
176-
public boolean equals(final java.lang.Object o) {
176+
public boolean equals(@Nullable final java.lang.Object o) {
177177

178178
if (o == this) {
179179
return true;

spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/json/patch/SpelPath.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public String toString() {
9393
}
9494

9595
@Override
96-
public boolean equals(Object obj) {
96+
public boolean equals(@Nullable Object obj) {
9797

9898
if (this == obj) {
9999
return true;
@@ -173,7 +173,7 @@ public static CacheKey of(Class<?> type, UntypedSpelPath path, BindContext conte
173173
}
174174

175175
@Override
176-
public boolean equals(Object o) {
176+
public boolean equals(@Nullable Object o) {
177177

178178
if (o == this) {
179179
return true;
@@ -529,7 +529,7 @@ public SkippedPropertyPath nested(String segment) {
529529
}
530530

531531
@Override
532-
public boolean equals(Object o) {
532+
public boolean equals(@Nullable Object o) {
533533

534534
if (o == this) {
535535
return true;
@@ -691,7 +691,7 @@ public SpelExpressionBuilder next(String segment) {
691691
}
692692

693693
@Override
694-
public boolean equals(Object o) {
694+
public boolean equals(@Nullable Object o) {
695695

696696
if (o == this) {
697697
return true;
@@ -721,7 +721,7 @@ public java.lang.String toString() {
721721
}
722722

723723
@Override
724-
public boolean equals(final java.lang.Object o) {
724+
public boolean equals(@Nullable final java.lang.Object o) {
725725

726726
if (o == this) {
727727
return true;

spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/support/DefaultedPageable.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import java.util.Objects;
1919

2020
import org.springframework.data.domain.Pageable;
21+
import org.springframework.lang.Nullable;
2122
import org.springframework.util.Assert;
2223

2324
/**
@@ -67,7 +68,7 @@ public Pageable unpagedIfDefault() {
6768
}
6869

6970
@Override
70-
public boolean equals(Object o) {
71+
public boolean equals(@Nullable Object o) {
7172

7273
if (o == this) {
7374
return true;

spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/support/ETag.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.springframework.data.mapping.PersistentPropertyAccessor;
2626
import org.springframework.data.rest.webmvc.PersistentEntityResource;
2727
import org.springframework.http.HttpHeaders;
28+
import org.springframework.lang.Nullable;
2829
import org.springframework.util.Assert;
2930

3031
/**
@@ -170,7 +171,7 @@ private static Optional<String> getVersionInformation(PersistentEntity<?, ? exte
170171
}
171172

172173
@Override
173-
public boolean equals(Object o) {
174+
public boolean equals(@Nullable Object o) {
174175

175176
if (o == this) {
176177
return true;

spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/support/RepositoryConstraintViolationExceptionMessage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public String getMessage() {
100100
}
101101

102102
@Override
103-
public boolean equals(Object o) {
103+
public boolean equals(@Nullable Object o) {
104104

105105
if (o == this) {
106106
return true;

0 commit comments

Comments
 (0)