1
1
/*
2
- * Copyright 2002-2020 the original author or authors.
2
+ * Copyright 2002-2021 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -1194,8 +1194,8 @@ public boolean equals(@Nullable Object other) {
1194
1194
this .primary == that .primary &&
1195
1195
this .nonPublicAccessAllowed == that .nonPublicAccessAllowed &&
1196
1196
this .lenientConstructorResolution == that .lenientConstructorResolution &&
1197
- ObjectUtils . nullSafeEquals ( this . constructorArgumentValues , that . constructorArgumentValues ) &&
1198
- ObjectUtils . nullSafeEquals ( this . propertyValues , that . propertyValues ) &&
1197
+ equalsConstructorArgumentValues ( that ) &&
1198
+ equalsPropertyValues ( that ) &&
1199
1199
ObjectUtils .nullSafeEquals (this .methodOverrides , that .methodOverrides ) &&
1200
1200
ObjectUtils .nullSafeEquals (this .factoryBeanName , that .factoryBeanName ) &&
1201
1201
ObjectUtils .nullSafeEquals (this .factoryMethodName , that .factoryMethodName ) &&
@@ -1208,12 +1208,30 @@ public boolean equals(@Nullable Object other) {
1208
1208
super .equals (other ));
1209
1209
}
1210
1210
1211
+ private boolean equalsConstructorArgumentValues (AbstractBeanDefinition other ) {
1212
+ if (!hasConstructorArgumentValues ()) {
1213
+ return !other .hasConstructorArgumentValues ();
1214
+ }
1215
+ return ObjectUtils .nullSafeEquals (this .constructorArgumentValues , other .constructorArgumentValues );
1216
+ }
1217
+
1218
+ private boolean equalsPropertyValues (AbstractBeanDefinition other ) {
1219
+ if (!hasPropertyValues ()) {
1220
+ return !other .hasPropertyValues ();
1221
+ }
1222
+ return ObjectUtils .nullSafeEquals (this .propertyValues , other .propertyValues );
1223
+ }
1224
+
1211
1225
@ Override
1212
1226
public int hashCode () {
1213
1227
int hashCode = ObjectUtils .nullSafeHashCode (getBeanClassName ());
1214
1228
hashCode = 29 * hashCode + ObjectUtils .nullSafeHashCode (this .scope );
1215
- hashCode = 29 * hashCode + ObjectUtils .nullSafeHashCode (this .constructorArgumentValues );
1216
- hashCode = 29 * hashCode + ObjectUtils .nullSafeHashCode (this .propertyValues );
1229
+ if (hasConstructorArgumentValues ()) {
1230
+ hashCode = 29 * hashCode + ObjectUtils .nullSafeHashCode (this .constructorArgumentValues );
1231
+ }
1232
+ if (hasPropertyValues ()) {
1233
+ hashCode = 29 * hashCode + ObjectUtils .nullSafeHashCode (this .propertyValues );
1234
+ }
1217
1235
hashCode = 29 * hashCode + ObjectUtils .nullSafeHashCode (this .factoryBeanName );
1218
1236
hashCode = 29 * hashCode + ObjectUtils .nullSafeHashCode (this .factoryMethodName );
1219
1237
hashCode = 29 * hashCode + super .hashCode ();
0 commit comments