DATACMNS-485 - Fixed bug in ParameterizedTypeInformation.hashCode().

Previously, ParameterizedTypeInformation.hashCode() had been inconsistent to equals in case of a fully resolved parameterized type. This is now fixed by not including the parent reference in case a parameterized type is resolved completely.

Also, TypeDiscoverer.getActualType() does not return the component type for non-collection/non-maps anymore to make sure we don't accidentally unwrap parameterized types.
This commit is contained in:
Oliver Gierke
2014-04-02 09:38:02 +02:00
parent 389edd6748
commit f52635da13
3 changed files with 39 additions and 8 deletions

View File

@@ -181,7 +181,7 @@ class ParameterizedTypeInformation<T> extends ParentTypeAwareTypeInformation<T>
*/
@Override
public int hashCode() {
return super.hashCode() + (isResolvedCompletely() ? this.type.hashCode() : 0);
return isResolvedCompletely() ? this.type.hashCode() : super.hashCode();
}
/*

View File

@@ -284,13 +284,7 @@ class TypeDiscoverer<S> implements TypeInformation<S> {
return getComponentType();
}
List<TypeInformation<?>> arguments = getTypeArguments();
if (arguments.isEmpty()) {
return this;
}
return arguments.get(arguments.size() - 1);
return this;
}
/*