Consistent equals/hashCode style (and related polishing)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 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.
|
||||
@@ -82,16 +82,11 @@ public class TypedValue {
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
if (!(other instanceof TypedValue otherTv)) {
|
||||
return false;
|
||||
}
|
||||
// Avoid TypeDescriptor initialization if not necessary
|
||||
return (ObjectUtils.nullSafeEquals(this.value, otherTv.value) &&
|
||||
((this.typeDescriptor == null && otherTv.typeDescriptor == null) ||
|
||||
ObjectUtils.nullSafeEquals(getTypeDescriptor(), otherTv.getTypeDescriptor())));
|
||||
return (this == other || (other instanceof TypedValue that &&
|
||||
ObjectUtils.nullSafeEquals(this.value, that.value) &&
|
||||
((this.typeDescriptor == null && that.typeDescriptor == null) ||
|
||||
ObjectUtils.nullSafeEquals(getTypeDescriptor(), that.getTypeDescriptor()))));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -591,14 +591,9 @@ public class ReflectivePropertyAccessor implements PropertyAccessor {
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
if (!(other instanceof PropertyCacheKey otherKey)) {
|
||||
return false;
|
||||
}
|
||||
return (this.clazz == otherKey.clazz && this.property.equals(otherKey.property) &&
|
||||
this.targetIsClass == otherKey.targetIsClass);
|
||||
return (this == other || (other instanceof PropertyCacheKey that &&
|
||||
this.clazz == that.clazz && this.property.equals(that.property) &&
|
||||
this.targetIsClass == that.targetIsClass));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user