Add Nullable annotation to parameter of overridden equals method.

Closes: #2196
Original pull request: #2197
This commit is contained in:
Christoph Strobl
2022-11-08 14:40:19 +01:00
committed by Mark Paluch
parent a9bfcfeb57
commit 6f68fe814f
10 changed files with 21 additions and 14 deletions

View File

@@ -17,6 +17,7 @@ package org.springframework.data.rest.core;
import java.util.regex.Pattern;
import org.springframework.lang.Nullable;
import org.springframework.util.StringUtils;
/**
@@ -103,7 +104,7 @@ public class Path {
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (this == obj) {
return true;

View File

@@ -29,6 +29,7 @@ import org.springframework.data.rest.core.config.EntityLookupRegistrar.LookupReg
import org.springframework.data.rest.core.support.EntityLookup;
import org.springframework.data.util.MethodInvocationRecorder;
import org.springframework.data.util.StreamUtils;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
/**
@@ -238,7 +239,7 @@ class EntityLookupConfiguration implements EntityLookupRegistrar {
}
@Override
public boolean equals(final java.lang.Object o) {
public boolean equals(@Nullable final java.lang.Object o) {
if (o == this) {
return true;

View File

@@ -24,6 +24,7 @@ import java.util.Set;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.data.rest.core.projection.ProjectionDefinitions;
import org.springframework.data.util.ProxyUtils;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
@@ -225,7 +226,7 @@ public class ProjectionDefinitionConfiguration implements ProjectionDefinitions
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (o == this) {
return true;

View File

@@ -33,6 +33,7 @@ import org.springframework.core.annotation.AnnotationAwareOrderComparator;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.data.rest.core.annotation.*;
import org.springframework.data.util.ProxyUtils;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
import org.springframework.util.LinkedMultiValueMap;
@@ -191,7 +192,7 @@ public class AnnotatedEventHandlerInvoker implements ApplicationListener<Reposit
}
@Override
public boolean equals(final java.lang.Object o) {
public boolean equals(@Nullable final java.lang.Object o) {
if (o == this) {
return true;

View File

@@ -18,6 +18,7 @@ package org.springframework.data.rest.core.mapping;
import org.springframework.core.MethodParameter;
import org.springframework.data.rest.core.annotation.Description;
import org.springframework.hateoas.LinkRelation;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
/**
@@ -71,7 +72,7 @@ public final class ParameterMetadata {
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (this == obj) {
return true;

View File

@@ -173,7 +173,7 @@ class DelegatingHandlerMapping implements MatchableHandlerMapping, Iterable<Hand
}
@Override
public boolean equals(final java.lang.Object o) {
public boolean equals(@Nullable final java.lang.Object o) {
if (o == this) {
return true;

View File

@@ -93,7 +93,7 @@ class SpelPath {
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (this == obj) {
return true;
@@ -173,7 +173,7 @@ class SpelPath {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (o == this) {
return true;
@@ -529,7 +529,7 @@ class SpelPath {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (o == this) {
return true;
@@ -691,7 +691,7 @@ class SpelPath {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (o == this) {
return true;
@@ -721,7 +721,7 @@ class SpelPath {
}
@Override
public boolean equals(final java.lang.Object o) {
public boolean equals(@Nullable final java.lang.Object o) {
if (o == this) {
return true;

View File

@@ -18,6 +18,7 @@ package org.springframework.data.rest.webmvc.support;
import java.util.Objects;
import org.springframework.data.domain.Pageable;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
/**
@@ -67,7 +68,7 @@ public final class DefaultedPageable {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (o == this) {
return true;

View File

@@ -25,6 +25,7 @@ import org.springframework.data.mapping.PersistentProperty;
import org.springframework.data.mapping.PersistentPropertyAccessor;
import org.springframework.data.rest.webmvc.PersistentEntityResource;
import org.springframework.http.HttpHeaders;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
/**
@@ -170,7 +171,7 @@ public final class ETag {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (o == this) {
return true;

View File

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