DATACMNS-697 - TypeDiscoverer now considers field-local generics information.

In case we create a ParameterizedTypeInformation for a property we now also analyze the field-local generics information and add the discovered type mappings to the type variable map.
This commit is contained in:
Oliver Gierke
2015-05-16 18:55:47 +02:00
parent 89f3be473c
commit 65104a4a3a
2 changed files with 42 additions and 2 deletions

View File

@@ -100,10 +100,21 @@ class TypeDiscoverer<S> implements TypeInformation<S> {
return new ClassTypeInformation((Class<?>) fieldType);
}
Map<TypeVariable, Type> variableMap = GenericTypeResolver.getTypeVariableMap(resolveType(fieldType));
Class<S> resolveType = resolveType(fieldType);
Map<TypeVariable, Type> variableMap = new HashMap<TypeVariable, Type>();
variableMap.putAll(GenericTypeResolver.getTypeVariableMap(resolveType));
if (fieldType instanceof ParameterizedType) {
ParameterizedType parameterizedType = (ParameterizedType) fieldType;
TypeVariable<Class<S>>[] typeParameters = resolveType.getTypeParameters();
Type[] arguments = parameterizedType.getActualTypeArguments();
for (int i = 0; i < typeParameters.length; i++) {
variableMap.put(typeParameters[i], arguments[i]);
}
return new ParameterizedTypeInformation(parameterizedType, this, variableMap);
}