DATACMNS-1180 - Polishing.
Avoid premature resolution of type in TypeDiscoverer.createInfo(…) and thereby simplify constructor in ParameterizedTypeInformation.
This commit is contained in:
@@ -51,9 +51,9 @@ class ParameterizedTypeInformation<T> extends ParentTypeAwareTypeInformation<T>
|
||||
* @param type must not be {@literal null}
|
||||
* @param parent must not be {@literal null}
|
||||
*/
|
||||
public ParameterizedTypeInformation(ParameterizedType type, Class<?> resolvedType, TypeDiscoverer<?> parent) {
|
||||
public ParameterizedTypeInformation(ParameterizedType type, TypeDiscoverer<?> parent) {
|
||||
|
||||
super(type, parent, calculateTypeVariables(type, resolvedType, parent));
|
||||
super(type, parent, calculateTypeVariables(type, parent));
|
||||
|
||||
this.type = type;
|
||||
this.resolved = Lazy.of(() -> isResolvedCompletely());
|
||||
@@ -248,13 +248,12 @@ class ParameterizedTypeInformation<T> extends ParentTypeAwareTypeInformation<T>
|
||||
* declared.
|
||||
*
|
||||
* @param type must not be {@literal null}.
|
||||
* @param resolvedType must not be {@literal null}.
|
||||
* @param parent must not be {@literal null}.
|
||||
* @return will never be {@literal null}.
|
||||
*/
|
||||
private static Map<TypeVariable<?>, Type> calculateTypeVariables(ParameterizedType type, Class<?> resolvedType,
|
||||
TypeDiscoverer<?> parent) {
|
||||
private static Map<TypeVariable<?>, Type> calculateTypeVariables(ParameterizedType type, TypeDiscoverer<?> parent) {
|
||||
|
||||
Class<?> resolvedType = parent.resolveType(type);
|
||||
TypeVariable<?>[] typeParameters = resolvedType.getTypeParameters();
|
||||
Type[] arguments = type.getActualTypeArguments();
|
||||
|
||||
|
||||
@@ -129,12 +129,10 @@ class TypeDiscoverer<S> implements TypeInformation<S> {
|
||||
return ClassTypeInformation.from((Class<?>) fieldType);
|
||||
}
|
||||
|
||||
Class<S> resolvedType = resolveType(fieldType);
|
||||
|
||||
if (fieldType instanceof ParameterizedType) {
|
||||
|
||||
ParameterizedType parameterizedType = (ParameterizedType) fieldType;
|
||||
return new ParameterizedTypeInformation(parameterizedType, resolvedType, this);
|
||||
return new ParameterizedTypeInformation(parameterizedType, this);
|
||||
}
|
||||
|
||||
if (fieldType instanceof TypeVariable) {
|
||||
|
||||
Reference in New Issue
Block a user