Consistent equals/hashCode style (and related polishing)

This commit is contained in:
Juergen Hoeller
2023-07-19 00:35:19 +02:00
parent bbcc788f60
commit 2f33e77ab4
98 changed files with 413 additions and 835 deletions

View File

@@ -51,13 +51,8 @@ public abstract class JCacheOperationSourcePointcut extends StaticMethodMatcherP
@Override
public boolean equals(@Nullable Object other) {
if (this == other) {
return true;
}
if (!(other instanceof JCacheOperationSourcePointcut otherPc)) {
return false;
}
return ObjectUtils.nullSafeEquals(getCacheOperationSource(), otherPc.getCacheOperationSource());
return (this == other || (other instanceof JCacheOperationSourcePointcut that &&
ObjectUtils.nullSafeEquals(getCacheOperationSource(), that.getCacheOperationSource())));
}
@Override

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -223,20 +223,15 @@ public class SimpleMailMessage implements MailMessage, Serializable {
@Override
public boolean equals(@Nullable Object other) {
if (this == other) {
return true;
}
if (!(other instanceof SimpleMailMessage otherMessage)) {
return false;
}
return (ObjectUtils.nullSafeEquals(this.from, otherMessage.from) &&
ObjectUtils.nullSafeEquals(this.replyTo, otherMessage.replyTo) &&
ObjectUtils.nullSafeEquals(this.to, otherMessage.to) &&
ObjectUtils.nullSafeEquals(this.cc, otherMessage.cc) &&
ObjectUtils.nullSafeEquals(this.bcc, otherMessage.bcc) &&
ObjectUtils.nullSafeEquals(this.sentDate, otherMessage.sentDate) &&
ObjectUtils.nullSafeEquals(this.subject, otherMessage.subject) &&
ObjectUtils.nullSafeEquals(this.text, otherMessage.text));
return (this == other || (other instanceof SimpleMailMessage that &&
ObjectUtils.nullSafeEquals(this.from, that.from) &&
ObjectUtils.nullSafeEquals(this.replyTo, that.replyTo) &&
ObjectUtils.nullSafeEquals(this.to, that.to) &&
ObjectUtils.nullSafeEquals(this.cc, that.cc) &&
ObjectUtils.nullSafeEquals(this.bcc, that.bcc) &&
ObjectUtils.nullSafeEquals(this.sentDate, that.sentDate) &&
ObjectUtils.nullSafeEquals(this.subject, that.subject) &&
ObjectUtils.nullSafeEquals(this.text, that.text)));
}
@Override