Resolve bounds for type variable before emptiness check
Closes gh-34328
This commit is contained in:
@@ -180,7 +180,7 @@ public final class GenericTypeResolver {
|
||||
generics[i] = resolvedTypeArgument;
|
||||
}
|
||||
else {
|
||||
generics[i] = ResolvableType.forType(typeArgument).resolveType();
|
||||
generics[i] = ResolvableType.forType(typeArgument);
|
||||
}
|
||||
}
|
||||
else if (typeArgument instanceof ParameterizedType) {
|
||||
@@ -226,7 +226,7 @@ public final class GenericTypeResolver {
|
||||
return resolvedType;
|
||||
}
|
||||
}
|
||||
return ResolvableType.NONE;
|
||||
return ResolvableType.forVariableBounds(typeVariable);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -953,14 +953,6 @@ public class ResolvableType implements Serializable {
|
||||
return NONE;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private Type resolveBounds(Type[] bounds) {
|
||||
if (bounds.length == 0 || bounds[0] == Object.class) {
|
||||
return null;
|
||||
}
|
||||
return bounds[0];
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private ResolvableType resolveVariable(TypeVariable<?> variable) {
|
||||
if (this.type instanceof TypeVariable) {
|
||||
@@ -1463,6 +1455,24 @@ public class ResolvableType implements Serializable {
|
||||
return new ResolvableType(arrayType, componentType, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a {@code ResolvableType} for the bounds of the specified {@link TypeVariable}.
|
||||
* @param typeVariable the type variable
|
||||
* @return a {@code ResolvableType} for the specified bounds
|
||||
* @since 6.2.3
|
||||
*/
|
||||
static ResolvableType forVariableBounds(TypeVariable<?> typeVariable) {
|
||||
return forType(resolveBounds(typeVariable.getBounds()));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static Type resolveBounds(Type[] bounds) {
|
||||
if (bounds.length == 0 || bounds[0] == Object.class) {
|
||||
return null;
|
||||
}
|
||||
return bounds[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a {@code ResolvableType} for the specified {@link Type}.
|
||||
* <p>Note: The resulting {@code ResolvableType} instance may not be {@link Serializable}.
|
||||
@@ -1491,7 +1501,6 @@ public class ResolvableType implements Serializable {
|
||||
return forType(type, variableResolver);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a {@code ResolvableType} for the specified {@link ParameterizedTypeReference}.
|
||||
* <p>Note: The resulting {@code ResolvableType} instance may not be {@link Serializable}.
|
||||
|
||||
Reference in New Issue
Block a user