@@ -80,7 +80,6 @@ public class TypeDescriptor implements Serializable {
80
80
* @param methodParameter the method parameter
81
81
*/
82
82
public TypeDescriptor (MethodParameter methodParameter ) {
83
- Assert .notNull (methodParameter , "MethodParameter must not be null" );
84
83
this .resolvableType = ResolvableType .forMethodParameter (methodParameter );
85
84
this .type = this .resolvableType .resolve (methodParameter .getParameterType ());
86
85
this .annotations = nullSafeAnnotations (methodParameter .getParameterIndex () == -1 ?
@@ -93,7 +92,6 @@ public TypeDescriptor(MethodParameter methodParameter) {
93
92
* @param field the field
94
93
*/
95
94
public TypeDescriptor (Field field ) {
96
- Assert .notNull (field , "Field must not be null" );
97
95
this .resolvableType = ResolvableType .forField (field );
98
96
this .type = this .resolvableType .resolve (field .getType ());
99
97
this .annotations = nullSafeAnnotations (field .getAnnotations ());
@@ -451,31 +449,31 @@ private TypeDescriptor narrow(Object value, TypeDescriptor typeDescriptor) {
451
449
}
452
450
453
451
@ Override
454
- public boolean equals (Object obj ) {
455
- if (this == obj ) {
452
+ public boolean equals (Object other ) {
453
+ if (this == other ) {
456
454
return true ;
457
455
}
458
- if (!(obj instanceof TypeDescriptor )) {
456
+ if (!(other instanceof TypeDescriptor )) {
459
457
return false ;
460
458
}
461
- TypeDescriptor other = (TypeDescriptor ) obj ;
462
- if (! ObjectUtils . nullSafeEquals ( this . type , other . type )) {
459
+ TypeDescriptor otherDesc = (TypeDescriptor ) other ;
460
+ if (getType () != otherDesc . getType ( )) {
463
461
return false ;
464
462
}
465
- if (getAnnotations ().length != other .getAnnotations ().length ) {
463
+ if (getAnnotations ().length != otherDesc .getAnnotations ().length ) {
466
464
return false ;
467
465
}
468
466
for (Annotation ann : getAnnotations ()) {
469
- if (!other .hasAnnotation (ann .annotationType ())) {
467
+ if (!otherDesc .hasAnnotation (ann .annotationType ())) {
470
468
return false ;
471
469
}
472
470
}
473
471
if (isCollection () || isArray ()) {
474
- return ObjectUtils .nullSafeEquals (getElementTypeDescriptor (), other .getElementTypeDescriptor ());
472
+ return ObjectUtils .nullSafeEquals (getElementTypeDescriptor (), otherDesc .getElementTypeDescriptor ());
475
473
}
476
474
else if (isMap ()) {
477
- return ObjectUtils .nullSafeEquals (getMapKeyTypeDescriptor (), other .getMapKeyTypeDescriptor ()) &&
478
- ObjectUtils .nullSafeEquals (getMapValueTypeDescriptor (), other .getMapValueTypeDescriptor ());
475
+ return ( ObjectUtils .nullSafeEquals (getMapKeyTypeDescriptor (), otherDesc .getMapKeyTypeDescriptor ()) &&
476
+ ObjectUtils .nullSafeEquals (getMapValueTypeDescriptor (), otherDesc .getMapValueTypeDescriptor () ));
479
477
}
480
478
else {
481
479
return true ;
0 commit comments