Skip to content

Commit fe549f7

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

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
@@ -219,7 +219,7 @@ public String toString() {
219219
}
220220

221221
@Override
222-
public boolean equals(Object o) {
222+
public boolean equals(@Nullable Object o) {
223223

224224
if (this == o)
225225
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
@@ -164,7 +164,7 @@ private static <T> Object doGetTimestamp(Object timestamp, Class<T> targetType)
164164
}
165165

166166
@Override
167-
public boolean equals(Object o) {
167+
public boolean equals(@Nullable Object o) {
168168
if (this == o)
169169
return true;
170170
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
@@ -550,7 +550,7 @@ public EntityCallbacks getEntityCallbacks() {
550550
}
551551

552552
@Override
553-
public boolean equals(Object o) {
553+
public boolean equals(@Nullable Object o) {
554554
if (this == o)
555555
return true;
556556
if (o == null || getClass() != o.getClass())
@@ -619,7 +619,7 @@ public WriteModel<Document> getModel() {
619619
}
620620

621621
@Override
622-
public boolean equals(Object o) {
622+
public boolean equals(@Nullable Object o) {
623623
if (this == o)
624624
return true;
625625
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
@@ -225,7 +225,7 @@ public MongoDatabaseFactory getDelegate() {
225225
}
226226

227227
@Override
228-
public boolean equals(Object o) {
228+
public boolean equals(@Nullable Object o) {
229229
if (this == o)
230230
return true;
231231
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
@@ -231,7 +231,7 @@ public ReactiveMongoDatabaseFactory getDelegate() {
231231
}
232232

233233
@Override
234-
public boolean equals(Object o) {
234+
public boolean equals(@Nullable Object o) {
235235
if (this == o)
236236
return true;
237237
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
@@ -294,7 +294,7 @@ public String toString() {
294294
}
295295

296296
@Override
297-
public boolean equals(Object obj) {
297+
public boolean equals(@Nullable Object obj) {
298298

299299
if (this == obj) {
300300
return true;
@@ -387,7 +387,7 @@ public String toString() {
387387
}
388388

389389
@Override
390-
public boolean equals(Object obj) {
390+
public boolean equals(@Nullable Object obj) {
391391

392392
if (this == obj) {
393393
return true;
@@ -454,7 +454,7 @@ public String toString() {
454454
}
455455

456456
@Override
457-
public boolean equals(Object obj) {
457+
public boolean equals(@Nullable Object obj) {
458458

459459
if (this == obj) {
460460
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
@@ -302,7 +302,7 @@ public String toString() {
302302
}
303303

304304
@Override
305-
public boolean equals(Object obj) {
305+
public boolean equals(@Nullable Object obj) {
306306

307307
if (this == obj) {
308308
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

@@ -63,7 +64,7 @@ public int hashCode() {
6364
}
6465

6566
@Override
66-
public boolean equals(Object obj) {
67+
public boolean equals(@Nullable Object obj) {
6768

6869
if (this == obj) {
6970
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

@@ -78,7 +79,7 @@ public int hashCode() {
7879
}
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/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

@@ -100,7 +101,7 @@ public int hashCode() {
100101
}
101102

102103
@Override
103-
public boolean equals(Object obj) {
104+
public boolean equals(@Nullable Object obj) {
104105

105106
if (this == obj) {
106107
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

@@ -62,7 +63,7 @@ public int hashCode() {
6263
}
6364

6465
@Override
65-
public boolean equals(Object obj) {
66+
public boolean equals(@Nullable Object obj) {
6667

6768
if (this == obj) {
6869
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

@@ -137,7 +138,7 @@ private static List<Point> asList(Point first, Point second, Point third, Point
137138
}
138139

139140
@Override
140-
public boolean equals(Object o) {
141+
public boolean equals(@Nullable Object o) {
141142
if (this == o) {
142143
return true;
143144
}

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
/**
@@ -98,7 +99,7 @@ public String toString() {
9899
}
99100

100101
@Override
101-
public boolean equals(Object obj) {
102+
public boolean equals(@Nullable Object obj) {
102103

103104
if (this == obj) {
104105
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
@@ -175,7 +175,7 @@ public boolean isWildcard() {
175175
}
176176

177177
@Override
178-
public boolean equals(Object obj) {
178+
public boolean equals(@Nullable Object obj) {
179179

180180
if (this == obj) {
181181
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
@@ -996,7 +996,7 @@ private static String toPath(Iterator<PersistentProperty<?>> iterator) {
996996
}
997997

998998
@Override
999-
public boolean equals(Object o) {
999+
public boolean equals(@Nullable Object o) {
10001000
if (this == o)
10011001
return true;
10021002
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
@@ -197,7 +197,7 @@ public int hashCode() {
197197
}
198198

199199
@Override
200-
public boolean equals(Object obj) {
200+
public boolean equals(@Nullable Object obj) {
201201

202202
if (this == obj) {
203203
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
/**
@@ -35,7 +36,7 @@ public MongoPersistentProperty getProperty() {
3536
}
3637

3738
@Override
38-
public boolean equals(Object obj) {
39+
public boolean equals(@Nullable Object obj) {
3940

4041
if (this == obj) {
4142
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
@@ -341,7 +341,7 @@ public <T> PersistentPropertyAccessor<T> getAccessorForOwner(T owner) {
341341
}
342342

343343
@Override
344-
public boolean equals(Object obj) {
344+
public boolean equals(@Nullable Object obj) {
345345

346346
if (this == obj) {
347347
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
*
@@ -77,7 +79,7 @@ public int hashCode() {
7779
}
7880

7981
@Override
80-
public boolean equals(Object obj) {
82+
public boolean equals(@Nullable Object obj) {
8183
if (this == obj) {
8284
return true;
8385
}

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
*/
@@ -61,7 +63,7 @@ public int hashCode() {
6163
}
6264

6365
@Override
64-
public boolean equals(Object obj) {
66+
public boolean equals(@Nullable Object obj) {
6567

6668
if (this == obj) {
6769
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
@@ -244,7 +244,7 @@ public void cancel() throws DataAccessResourceFailureException {
244244
}
245245

246246
@Override
247-
public boolean equals(Object o) {
247+
public boolean equals(@Nullable Object o) {
248248
if (this == o)
249249
return true;
250250
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
@@ -120,7 +120,7 @@ public static MessagePropertiesBuilder builder() {
120120
}
121121

122122
@Override
123-
public boolean equals(Object o) {
123+
public boolean equals(@Nullable Object o) {
124124
if (this == o)
125125
return true;
126126
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
@@ -61,7 +61,7 @@ public MessageProperties getProperties() {
6161
}
6262

6363
@Override
64-
public boolean equals(Object o) {
64+
public boolean equals(@Nullable Object o) {
6565
if (this == o)
6666
return true;
6767
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
@@ -152,7 +152,7 @@ public void setFieldsObject(Document fieldsObject) {
152152
}
153153

154154
@Override
155-
public boolean equals(Object o) {
155+
public boolean equals(@Nullable Object o) {
156156

157157
if (this == o) {
158158
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
@@ -971,7 +971,7 @@ private boolean createNearCriteriaForCommand(String command, String operation, d
971971
}
972972

973973
@Override
974-
public boolean equals(Object obj) {
974+
public boolean equals(@Nullable Object obj) {
975975

976976
if (this == obj) {
977977
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
/**
@@ -99,7 +100,7 @@ public int hashCode() {
99100
}
100101

101102
@Override
102-
public boolean equals(Object obj) {
103+
public boolean equals(@Nullable Object obj) {
103104

104105
if (this == obj) {
105106
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
@@ -244,7 +244,7 @@ public int hashCode() {
244244
}
245245

246246
@Override
247-
public boolean equals(Object obj) {
247+
public boolean equals(@Nullable Object obj) {
248248

249249
if (this == obj) {
250250
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
@@ -563,7 +563,7 @@ public String toString() {
563563
}
564564

565565
@Override
566-
public boolean equals(Object obj) {
566+
public boolean equals(@Nullable Object obj) {
567567

568568
if (this == obj) {
569569
return true;

0 commit comments

Comments
 (0)