Skip to content

Commit d76c843

Browse files
christophstroblmp911de
authored andcommitted
Add Nullable annotation to parameter of overridden equals method.
Closes: #4226 Original pull request: #4277
1 parent f5ea80a commit d76c843

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+85
-57
lines changed

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ChangeStreamEvent.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ public String toString() {
199199
}
200200

201201
@Override
202-
public boolean equals(Object o) {
202+
public boolean equals(@Nullable Object o) {
203203

204204
if (this == o)
205205
return true;

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ChangeStreamOptions.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ private static <T> Object doGetTimestamp(Object timestamp, Class<T> targetType)
153153
}
154154

155155
@Override
156-
public boolean equals(Object o) {
156+
public boolean equals(@Nullable Object o) {
157157
if (this == o)
158158
return true;
159159
if (o == null || getClass() != o.getClass())

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/DefaultBulkOperations.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ public EntityCallbacks getEntityCallbacks() {
598598
}
599599

600600
@Override
601-
public boolean equals(Object o) {
601+
public boolean equals(@Nullable Object o) {
602602
if (this == o)
603603
return true;
604604
if (o == null || getClass() != o.getClass())
@@ -667,7 +667,7 @@ public WriteModel<Document> getModel() {
667667
}
668668

669669
@Override
670-
public boolean equals(Object o) {
670+
public boolean equals(@Nullable Object o) {
671671
if (this == o)
672672
return true;
673673
if (o == null || getClass() != o.getClass())

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoDatabaseFactorySupport.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ public MongoDatabaseFactory getDelegate() {
269269
}
270270

271271
@Override
272-
public boolean equals(Object o) {
272+
public boolean equals(@Nullable Object o) {
273273
if (this == o)
274274
return true;
275275
if (o == null || getClass() != o.getClass())

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/SimpleReactiveMongoDatabaseFactory.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ public ReactiveMongoDatabaseFactory getDelegate() {
283283
}
284284

285285
@Override
286-
public boolean equals(Object o) {
286+
public boolean equals(@Nullable Object o) {
287287
if (this == o)
288288
return true;
289289
if (o == null || getClass() != o.getClass())

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/ExposedFields.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ public String toString() {
318318
* @see java.lang.Object#equals(java.lang.Object)
319319
*/
320320
@Override
321-
public boolean equals(Object obj) {
321+
public boolean equals(@Nullable Object obj) {
322322

323323
if (this == obj) {
324324
return true;
@@ -431,7 +431,7 @@ public String toString() {
431431
* @see java.lang.Object#equals(java.lang.Object)
432432
*/
433433
@Override
434-
public boolean equals(Object obj) {
434+
public boolean equals(@Nullable Object obj) {
435435

436436
if (this == obj) {
437437
return true;
@@ -510,7 +510,7 @@ public String toString() {
510510
}
511511

512512
@Override
513-
public boolean equals(Object obj) {
513+
public boolean equals(@Nullable Object obj) {
514514

515515
if (this == obj) {
516516
return true;

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/Fields.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ public String toString() {
326326
* @see java.lang.Object#equals(java.lang.Object)
327327
*/
328328
@Override
329-
public boolean equals(Object obj) {
329+
public boolean equals(@Nullable Object obj) {
330330

331331
if (this == obj) {
332332
return true;

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/geo/GeoJsonGeometryCollection.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import java.util.Collections;
2020
import java.util.List;
2121

22+
import org.springframework.lang.Nullable;
2223
import org.springframework.util.Assert;
2324
import org.springframework.util.ObjectUtils;
2425

@@ -79,7 +80,7 @@ public int hashCode() {
7980
* @see java.lang.Object#equals(java.lang.Object)
8081
*/
8182
@Override
82-
public boolean equals(Object obj) {
83+
public boolean equals(@Nullable Object obj) {
8384

8485
if (this == obj) {
8586
return true;

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/geo/GeoJsonMultiLineString.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import java.util.List;
2121

2222
import org.springframework.data.geo.Point;
23+
import org.springframework.lang.Nullable;
2324
import org.springframework.util.Assert;
2425
import org.springframework.util.ObjectUtils;
2526

@@ -94,7 +95,7 @@ public int hashCode() {
9495
* @see java.lang.Object#equals(java.lang.Object)
9596
*/
9697
@Override
97-
public boolean equals(Object obj) {
98+
public boolean equals(@Nullable Object obj) {
9899

99100
if (this == obj) {
100101
return true;

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/geo/GeoJsonMultiPoint.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.util.List;
2222

2323
import org.springframework.data.geo.Point;
24+
import org.springframework.lang.Nullable;
2425
import org.springframework.util.Assert;
2526
import org.springframework.util.ObjectUtils;
2627

@@ -116,7 +117,7 @@ public int hashCode() {
116117
* @see java.lang.Object#equals(java.lang.Object)
117118
*/
118119
@Override
119-
public boolean equals(Object obj) {
120+
public boolean equals(@Nullable Object obj) {
120121

121122
if (this == obj) {
122123
return true;

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/geo/GeoJsonMultiPolygon.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import java.util.Collections;
2020
import java.util.List;
2121

22+
import org.springframework.lang.Nullable;
2223
import org.springframework.util.Assert;
2324
import org.springframework.util.ObjectUtils;
2425

@@ -78,7 +79,7 @@ public int hashCode() {
7879
* @see java.lang.Object#equals(java.lang.Object)
7980
*/
8081
@Override
81-
public boolean equals(Object obj) {
82+
public boolean equals(@Nullable Object obj) {
8283

8384
if (this == obj) {
8485
return true;

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/geo/GeoJsonPolygon.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
import org.springframework.data.geo.Point;
2525
import org.springframework.data.geo.Polygon;
26+
import org.springframework.lang.Nullable;
2627
import org.springframework.util.Assert;
2728
import org.springframework.util.ObjectUtils;
2829

@@ -145,7 +146,7 @@ private static List<Point> asList(Point first, Point second, Point third, Point
145146
}
146147

147148
@Override
148-
public boolean equals(Object o) {
149+
public boolean equals(@Nullable Object o) {
149150
if (this == o) {
150151
return true;
151152
}

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/geo/Sphere.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.springframework.data.geo.Distance;
2424
import org.springframework.data.geo.Point;
2525
import org.springframework.data.geo.Shape;
26+
import org.springframework.lang.Nullable;
2627
import org.springframework.util.Assert;
2728

2829
/**
@@ -105,7 +106,7 @@ public String toString() {
105106
* @see java.lang.Object#equals(java.lang.Object)
106107
*/
107108
@Override
108-
public boolean equals(Object obj) {
109+
public boolean equals(@Nullable Object obj) {
109110

110111
if (this == obj) {
111112
return true;

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/IndexField.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ public boolean isWildcard() {
179179
* @see java.lang.Object#equals(java.lang.Object)
180180
*/
181181
@Override
182-
public boolean equals(Object obj) {
182+
public boolean equals(@Nullable Object obj) {
183183

184184
if (this == obj) {
185185
return true;

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/IndexInfo.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ public int hashCode() {
283283
}
284284

285285
@Override
286-
public boolean equals(Object obj) {
286+
public boolean equals(@Nullable Object obj) {
287287
if (this == obj) {
288288
return true;
289289
}

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/MongoPersistentEntityIndexResolver.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,7 @@ private static String toPath(Iterator<PersistentProperty<?>> iterator) {
991991
}
992992

993993
@Override
994-
public boolean equals(Object o) {
994+
public boolean equals(@Nullable Object o) {
995995
if (this == o)
996996
return true;
997997
if (o == null || getClass() != o.getClass())

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/TextIndexDefinition.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ public int hashCode() {
205205
}
206206

207207
@Override
208-
public boolean equals(Object obj) {
208+
public boolean equals(@Nullable Object obj) {
209209

210210
if (this == obj) {
211211
return true;

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/mapping/UnwrapEntityContext.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616
package org.springframework.data.mongodb.core.mapping;
1717

18+
import org.springframework.lang.Nullable;
1819
import org.springframework.util.ObjectUtils;
1920

2021
/**
@@ -39,7 +40,7 @@ public MongoPersistentProperty getProperty() {
3940
* @see java.lang.Object#equals(java.lang.Object)
4041
*/
4142
@Override
42-
public boolean equals(Object obj) {
43+
public boolean equals(@Nullable Object obj) {
4344

4445
if (this == obj) {
4546
return true;

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/mapping/UnwrappedMongoPersistentProperty.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ public <T> PersistentPropertyAccessor<T> getAccessorForOwner(T owner) {
350350
* @see java.lang.Object#equals(java.lang.Object)
351351
*/
352352
@Override
353-
public boolean equals(Object obj) {
353+
public boolean equals(@Nullable Object obj) {
354354

355355
if (this == obj) {
356356
return true;

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/mapreduce/MapReduceCounts.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
*/
1616
package org.springframework.data.mongodb.core.mapreduce;
1717

18+
import org.springframework.lang.Nullable;
19+
1820
/**
1921
* Value object to encapsulate results of a map-reduce count.
2022
*
@@ -89,7 +91,7 @@ public int hashCode() {
8991
* @see java.lang.Object#equals(java.lang.Object)
9092
*/
9193
@Override
92-
public boolean equals(Object obj) {
94+
public boolean equals(@Nullable Object obj) {
9395
if (this == obj) {
9496
return true;
9597
}

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/mapreduce/MapReduceTiming.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
*/
1616
package org.springframework.data.mongodb.core.mapreduce;
1717

18+
import org.springframework.lang.Nullable;
19+
1820
/**
1921
* @deprecated since 3.4 in favor of {@link org.springframework.data.mongodb.core.aggregation}.
2022
*/
@@ -74,7 +76,7 @@ public int hashCode() {
7476
* @see java.lang.Object#equals(java.lang.Object)
7577
*/
7678
@Override
77-
public boolean equals(Object obj) {
79+
public boolean equals(@Nullable Object obj) {
7880

7981
if (this == obj) {
8082
return true;

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/messaging/DefaultMessageListenerContainer.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ public void cancel() throws DataAccessResourceFailureException {
284284
}
285285

286286
@Override
287-
public boolean equals(Object o) {
287+
public boolean equals(@Nullable Object o) {
288288
if (this == o)
289289
return true;
290290
if (o == null || getClass() != o.getClass())

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/messaging/Message.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public static MessagePropertiesBuilder builder() {
108108
}
109109

110110
@Override
111-
public boolean equals(Object o) {
111+
public boolean equals(@Nullable Object o) {
112112
if (this == o)
113113
return true;
114114
if (o == null || getClass() != o.getClass())

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/messaging/SimpleMessage.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public MessageProperties getProperties() {
7373
}
7474

7575
@Override
76-
public boolean equals(Object o) {
76+
public boolean equals(@Nullable Object o) {
7777
if (this == o)
7878
return true;
7979
if (o == null || getClass() != o.getClass())

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/BasicQuery.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public void setFieldsObject(Document fieldsObject) {
176176
* @see org.springframework.data.mongodb.core.query.Query#equals(java.lang.Object)
177177
*/
178178
@Override
179-
public boolean equals(Object o) {
179+
public boolean equals(@Nullable Object o) {
180180

181181
if (this == o) {
182182
return true;

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Collation.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import org.bson.Document;
2222
import org.springframework.core.convert.converter.Converter;
23+
import org.springframework.lang.Nullable;
2324
import org.springframework.util.Assert;
2425
import org.springframework.util.StringUtils;
2526

@@ -399,7 +400,7 @@ public String toString() {
399400
}
400401

401402
@Override
402-
public boolean equals(Object o) {
403+
public boolean equals(@Nullable Object o) {
403404

404405
if (this == o) {
405406
return true;

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Criteria.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ private boolean createNearCriteriaForCommand(String command, String operation, d
979979
* @see java.lang.Object#equals(java.lang.Object)
980980
*/
981981
@Override
982-
public boolean equals(Object obj) {
982+
public boolean equals(@Nullable Object obj) {
983983

984984
if (this == obj) {
985985
return true;

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Field.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ public Document getFieldsObject() {
241241
}
242242

243243
@Override
244-
public boolean equals(Object o) {
244+
public boolean equals(@Nullable Object o) {
245245

246246
if (this == o)
247247
return true;

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/GeoCommand.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.springframework.data.geo.Polygon;
2323
import org.springframework.data.geo.Shape;
2424
import org.springframework.data.mongodb.core.geo.Sphere;
25+
import org.springframework.lang.Nullable;
2526
import org.springframework.util.Assert;
2627

2728
/**
@@ -107,7 +108,7 @@ public int hashCode() {
107108
* @see java.lang.Object#equals(java.lang.Object)
108109
*/
109110
@Override
110-
public boolean equals(Object obj) {
111+
public boolean equals(@Nullable Object obj) {
111112

112113
if (this == obj) {
113114
return true;

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Meta.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ public int hashCode() {
265265
* @see java.lang.Object#equals(java.lang.Object)
266266
*/
267267
@Override
268-
public boolean equals(Object obj) {
268+
public boolean equals(@Nullable Object obj) {
269269

270270
if (this == obj) {
271271
return true;

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Query.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ public String toString() {
603603
* @see java.lang.Object#equals(java.lang.Object)
604604
*/
605605
@Override
606-
public boolean equals(Object obj) {
606+
public boolean equals(@Nullable Object obj) {
607607

608608
if (this == obj) {
609609
return true;

0 commit comments

Comments
 (0)