Skip to content

Commit

Permalink
Add Nullable annotation to parameter of overridden equals method.
Browse files Browse the repository at this point in the history
Closes: #2196
Original pull request: #2197
  • Loading branch information
christophstrobl authored and mp911de committed Dec 2, 2022
1 parent a9bfcfe commit 6f68fe8
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import java.util.regex.Pattern;

import org.springframework.lang.Nullable;
import org.springframework.util.StringUtils;

/**
Expand Down Expand Up @@ -103,7 +104,7 @@ public String toString() {
}

@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {

if (this == obj) {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
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;

/**
Expand Down Expand Up @@ -238,7 +239,7 @@ public Lookup<R, ID> getLookup() {
}

@Override
public boolean equals(final java.lang.Object o) {
public boolean equals(@Nullable final java.lang.Object o) {

if (o == this) {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
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;

Expand Down Expand Up @@ -225,7 +226,7 @@ public String getName() {
}

@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {

if (o == this) {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
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;
Expand Down Expand Up @@ -191,7 +192,7 @@ public int compareTo(EventHandlerMethod o) {
}

@Override
public boolean equals(final java.lang.Object o) {
public boolean equals(@Nullable final java.lang.Object o) {

if (o == this) {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
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;

/**
Expand Down Expand Up @@ -71,7 +72,7 @@ public ResourceDescription getDescription() {
}

@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {

if (this == obj) {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public HandlerSelectionResult(HttpServletRequest request, HandlerMapping mapping
}

@Override
public boolean equals(final java.lang.Object o) {
public boolean equals(@Nullable final java.lang.Object o) {

if (o == this) {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public String toString() {
}

@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {

if (this == obj) {
return true;
Expand Down Expand Up @@ -173,7 +173,7 @@ public static CacheKey of(Class<?> type, UntypedSpelPath path, BindContext conte
}

@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {

if (o == this) {
return true;
Expand Down Expand Up @@ -529,7 +529,7 @@ public SkippedPropertyPath nested(String segment) {
}

@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {

if (o == this) {
return true;
Expand Down Expand Up @@ -691,7 +691,7 @@ public SpelExpressionBuilder next(String segment) {
}

@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {

if (o == this) {
return true;
Expand Down Expand Up @@ -721,7 +721,7 @@ public java.lang.String toString() {
}

@Override
public boolean equals(final java.lang.Object o) {
public boolean equals(@Nullable final java.lang.Object o) {

if (o == this) {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.util.Objects;

import org.springframework.data.domain.Pageable;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;

/**
Expand Down Expand Up @@ -67,7 +68,7 @@ public Pageable unpagedIfDefault() {
}

@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {

if (o == this) {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
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;

/**
Expand Down Expand Up @@ -170,7 +171,7 @@ private static Optional<String> getVersionInformation(PersistentEntity<?, ? exte
}

@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {

if (o == this) {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public String getMessage() {
}

@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {

if (o == this) {
return true;
Expand Down

0 comments on commit 6f68fe8

Please sign in to comment.