@@ -498,12 +498,13 @@ public static TypeDescriptor valueOf(Class<?> type) {
498
498
*/
499
499
public static TypeDescriptor collection (Class <?> collectionType , TypeDescriptor elementTypeDescriptor ) {
500
500
Assert .notNull (collectionType , "CollectionType must not be null" );
501
- Assert .notNull (elementTypeDescriptor , "ElementTypeDesciptor must not be null" );
502
501
if (!Collection .class .isAssignableFrom (collectionType )) {
503
502
throw new IllegalArgumentException ("collectionType must be a java.util.Collection" );
504
503
}
504
+ ResolvableType element = (elementTypeDescriptor == null ? null
505
+ : elementTypeDescriptor .resolvableType );
505
506
return new TypeDescriptor (ResolvableType .forClassWithGenerics (collectionType ,
506
- elementTypeDescriptor . resolvableType ), null , null );
507
+ element ), null , null );
507
508
}
508
509
509
510
/**
@@ -520,8 +521,9 @@ public static TypeDescriptor map(Class<?> mapType, TypeDescriptor keyTypeDescrip
520
521
if (!Map .class .isAssignableFrom (mapType )) {
521
522
throw new IllegalArgumentException ("mapType must be a java.util.Map" );
522
523
}
523
- return new TypeDescriptor (ResolvableType .forClassWithGenerics (mapType ,
524
- keyTypeDescriptor .resolvableType , valueTypeDescriptor .resolvableType ), null , null );
524
+ ResolvableType key = (keyTypeDescriptor == null ? null : keyTypeDescriptor .resolvableType );
525
+ ResolvableType value = (valueTypeDescriptor == null ? null : valueTypeDescriptor .resolvableType );
526
+ return new TypeDescriptor (ResolvableType .forClassWithGenerics (mapType , key , value ), null , null );
525
527
}
526
528
527
529
/**
0 commit comments