GenericTypeResolver's resolveTypeArguments needs to return null for raw types (for backwards compatibility with 3.2)

Issue: SPR-11052
This commit is contained in:
Juergen Hoeller
2013-10-31 15:28:20 +01:00
parent 84bc474016
commit 9f3b8a2430
4 changed files with 53 additions and 56 deletions

View File

@@ -240,12 +240,12 @@ public abstract class GenericTypeResolver {
* @return the resolved type of each argument, with the array size matching the
* number of actual type arguments, or {@code null} if not resolvable
*/
public static Class[] resolveTypeArguments(Class<?> clazz, Class<?> genericIfc) {
public static Class<?>[] resolveTypeArguments(Class<?> clazz, Class<?> genericIfc) {
ResolvableType type = ResolvableType.forClass(clazz).as(genericIfc);
if (!type.hasGenerics()) {
if (!type.hasGenerics() || type.hasUnresolvableGenerics()) {
return null;
}
return type.resolveGenerics(Object.class);
return type.resolveGenerics();
}
/**

View File

@@ -567,7 +567,7 @@ public final class ResolvableType implements Serializable {
this.resolved = resolveClass();
this.isResolved = true;
}
return (this.resolved == null ? fallback : this.resolved);
return (this.resolved != null ? this.resolved : fallback);
}
private Class<?> resolveClass() {
@@ -576,7 +576,7 @@ public final class ResolvableType implements Serializable {
}
if (this.type instanceof GenericArrayType) {
Class<?> resolvedComponent = getComponentType().resolve();
return (resolvedComponent == null ? null : Array.newInstance(resolvedComponent, 0).getClass());
return (resolvedComponent != null ? Array.newInstance(resolvedComponent, 0).getClass() : null);
}
return resolveType().resolve();
}