Add Nullable annotation to parameter of overridden equals method.

Closes #1374
Original pull request #1375
This commit is contained in:
Christoph Strobl
2022-11-08 14:13:47 +01:00
committed by Jens Schauder
parent ae1bb6a448
commit 5fbc68ef87
17 changed files with 29 additions and 20 deletions

View File

@@ -208,7 +208,7 @@ public final class Identifier {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o)
return true;
@@ -272,7 +272,7 @@ public final class Identifier {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;

View File

@@ -17,6 +17,8 @@ package org.springframework.data.jdbc.core.convert;
import java.util.Objects;
import org.springframework.lang.Nullable;
/**
* The subject of an insert, described by the entity instance and its {@link Identifier}, where identifier contains
* information about data that needs to be considered for the insert but which is not part of the entity. Namely
@@ -50,7 +52,7 @@ public final class InsertSubject<T> {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o)
return true;

View File

@@ -1001,7 +1001,7 @@ class SqlGenerator {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;

View File

@@ -65,7 +65,7 @@ public interface AggregateReference<T, ID> {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o)
return true;

View File

@@ -55,7 +55,7 @@ public class JdbcValue {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o)
return true;

View File

@@ -352,7 +352,7 @@ class JdbcQueryCreator extends RelationalQueryCreator<ParametrizedQuery> {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o)
return true;

View File

@@ -382,7 +382,7 @@ abstract class NamedParameterUtils {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o)
return true;
if (!(o instanceof ParameterHolder))

View File

@@ -24,6 +24,7 @@ import java.util.Set;
import java.util.function.BiConsumer;
import org.springframework.data.relational.core.sql.SqlIdentifier;
import org.springframework.lang.Nullable;
import org.springframework.r2dbc.core.Parameter;
import org.springframework.util.Assert;
@@ -195,7 +196,7 @@ public class OutboundRow implements Map<SqlIdentifier, Parameter>, Cloneable {
}
@Override
public boolean equals(final Object o) {
public boolean equals(@Nullable final Object o) {
if (this == o) {
return true;

View File

@@ -142,7 +142,7 @@ public abstract class AbstractR2dbcRepositoryWithMixedCaseNamesIntegrationTests
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())

View File

@@ -21,6 +21,7 @@ import java.util.function.UnaryOperator;
import org.springframework.data.relational.core.sql.IdentifierProcessing;
import org.springframework.data.relational.core.sql.SqlIdentifier;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
/**
@@ -69,7 +70,7 @@ class DerivedSqlIdentifier implements SqlIdentifier {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;

View File

@@ -486,7 +486,7 @@ public class PersistentPropertyPathExtension {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o)
return true;

View File

@@ -17,6 +17,7 @@ package org.springframework.data.relational.core.mapping.event;
import java.util.Objects;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
/**
@@ -56,7 +57,7 @@ public final class Identifier {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o)
return true;

View File

@@ -15,6 +15,7 @@
*/
package org.springframework.data.relational.core.sql;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
@@ -50,7 +51,7 @@ abstract class AbstractSegment implements Segment {
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
return obj instanceof Segment && toString().equals(obj.toString());
}

View File

@@ -360,7 +360,7 @@ public class Column extends AbstractSegment implements Expression, Named {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
@@ -421,7 +421,7 @@ public class Column extends AbstractSegment implements Expression, Named {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;

View File

@@ -20,6 +20,7 @@ import java.util.Iterator;
import java.util.StringJoiner;
import java.util.function.UnaryOperator;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
/**
@@ -70,7 +71,7 @@ class CompositeSqlIdentifier implements SqlIdentifier {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;

View File

@@ -19,6 +19,7 @@ import java.util.Collections;
import java.util.Iterator;
import java.util.function.UnaryOperator;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
/**
@@ -65,7 +66,7 @@ class DefaultSqlIdentifier implements SqlIdentifier {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;

View File

@@ -17,6 +17,7 @@ package org.springframework.data.relational.core.sql;
import java.util.Objects;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
/**
@@ -131,7 +132,7 @@ public class Table extends AbstractSegment implements TableLike {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}
@@ -189,7 +190,7 @@ public class Table extends AbstractSegment implements TableLike {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;