Skip to content

Commit d8f3c63

Browse files
committed
refactor equals for IndexOptions
1 parent 7f60eca commit d8f3c63

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

server/src/main/java/org/elasticsearch/index/mapper/vectors/SparseVectorFieldMapper.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -454,10 +454,13 @@ public final boolean equals(Object other) {
454454
if (other == this) {
455455
return true;
456456
}
457-
if (other instanceof IndexOptions otherOptions) {
458-
return Objects.equals(prune, otherOptions.prune) && Objects.equals(pruningConfig, otherOptions.pruningConfig);
457+
458+
if (other == null || getClass() != other.getClass()) {
459+
return false;
459460
}
460-
return false;
461+
462+
IndexOptions otherAsIndexOptions = (IndexOptions) other;
463+
return Objects.equals(prune, otherAsIndexOptions.prune) && Objects.equals(pruningConfig, otherAsIndexOptions.pruningConfig);
461464
}
462465

463466
@Override

0 commit comments

Comments
 (0)