Prefer explicitly declared generic parameter over Iterable in TypeDiscoverer.getComponentType().

Related ticket: #2312.
This commit is contained in:
Oliver Drotbohm
2022-06-10 22:12:37 +02:00
parent 07342cffb5
commit 0f85f1c720
2 changed files with 20 additions and 3 deletions

View File

@@ -148,6 +148,12 @@ class TypeDiscoverer<S> implements TypeInformation<S> {
return getTypeArgument(CustomCollections.getMapBaseType(rawType), 0);
}
List<TypeInformation<?>> arguments = getTypeArguments();
if (arguments.size() > 0) {
return arguments.get(0);
}
if (Iterable.class.isAssignableFrom(rawType)) {
return getTypeArgument(Iterable.class, 0);
}
@@ -156,9 +162,7 @@ class TypeDiscoverer<S> implements TypeInformation<S> {
return getTypeArgument(rawType, 0);
}
List<TypeInformation<?>> arguments = getTypeArguments();
return arguments.size() > 0 ? arguments.get(0) : null;
return null;
}
@Override