DATACMNS-1828 - Fix Map component type lookup for custom Map implementations.
Instead of using the first generic type parameter of a parameterized type as Map component type, we now explicitly lookup the super type's Map-specific generics configuration and use its first generic type parameter. The same for collection like types falling back to the parameter type bound to Iterable.
This commit is contained in:
@@ -156,6 +156,17 @@ class ParameterizedTypeInformation<T> extends ParentTypeAwareTypeInformation<T>
|
||||
@Override
|
||||
@Nullable
|
||||
protected TypeInformation<?> doGetComponentType() {
|
||||
|
||||
boolean isCustomMapImplementation = isMap() && !getType().equals(Map.class);
|
||||
|
||||
if (isCustomMapImplementation) {
|
||||
return getRequiredSuperTypeInformation(Map.class).getComponentType();
|
||||
}
|
||||
|
||||
if (isCollectionLike() && !getType().getPackage().getName().startsWith("java.")) {
|
||||
return getRequiredSuperTypeInformation(Iterable.class).getComponentType();
|
||||
}
|
||||
|
||||
return createInfo(type.getActualTypeArguments()[0]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user