GenericTypeResolver's resolveTypeArguments needs to return null for raw types (for backwards compatibility with 3.2)
Issue: SPR-11052
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user