Consistently declare Object::equals argument as @Nullable

This commit is contained in:
Sam Brannen
2023-03-13 21:43:21 +01:00
parent a6dab10309
commit 00be19c647
74 changed files with 149 additions and 103 deletions

View File

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

View File

@@ -22,6 +22,7 @@ import java.util.List;
import org.junit.jupiter.api.Test;
import org.springframework.beans.testfixture.beans.TestBean;
import org.springframework.lang.Nullable;
import static org.assertj.core.api.Assertions.assertThat;
@@ -194,7 +195,7 @@ public class PagedListHolderTests {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

View File

@@ -16,6 +16,8 @@
package org.springframework.beans.testfixture.beans;
import org.springframework.lang.Nullable;
/**
* Simple nested test bean used for testing bean factories, AOP framework etc.
*
@@ -43,7 +45,7 @@ public class NestedTestBean implements INestedTestBean {
}
@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (!(obj instanceof NestedTestBean ntb)) {
return false;
}

View File

@@ -16,6 +16,8 @@
package org.springframework.beans.testfixture.beans;
import org.springframework.lang.Nullable;
/**
* @author Rob Harrop
* @since 2.0
@@ -38,7 +40,7 @@ public class Pet {
}
@Override
public boolean equals(Object o) {
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}

View File

@@ -18,6 +18,7 @@ package org.springframework.beans.testfixture.beans;
import java.io.Serializable;
import org.springframework.lang.Nullable;
import org.springframework.util.ObjectUtils;
/**
@@ -63,7 +64,7 @@ public class SerializablePerson implements Person, Serializable {
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
if (!(other instanceof SerializablePerson p)) {
return false;
}

View File

@@ -30,6 +30,7 @@ import java.util.Set;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.lang.Nullable;
import org.springframework.util.ObjectUtils;
/**
@@ -464,7 +465,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
@Override
public boolean equals(Object other) {
public boolean equals(@Nullable Object other) {
if (this == other) {
return true;
}