Consider wildcard type without bounds as eligible for fallback match too
Issue: SPR-11250
This commit is contained in:
@@ -399,7 +399,7 @@ public final class ResolvableType implements Serializable {
|
||||
}
|
||||
ResolvableType[] generics = getGenerics();
|
||||
for (ResolvableType generic : generics) {
|
||||
if (generic.isUnresolvableTypeVariable()) {
|
||||
if (generic.isUnresolvableTypeVariable() || generic.isWildcardWithoutBounds()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -435,6 +435,23 @@ public final class ResolvableType implements Serializable {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the underlying type represents a wildcard
|
||||
* without specific bounds (i.e., equal to {@code ? extends Object}).
|
||||
*/
|
||||
private boolean isWildcardWithoutBounds() {
|
||||
if (this.type instanceof WildcardType) {
|
||||
WildcardType wt = (WildcardType) this.type;
|
||||
if (wt.getLowerBounds().length == 0) {
|
||||
Type[] upperBounds = wt.getUpperBounds();
|
||||
if (upperBounds.length == 0 || (upperBounds.length == 1 && Object.class.equals(upperBounds[0]))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a {@link ResolvableType} for the specified nesting level. See
|
||||
* {@link #getNested(int, Map)} for details.
|
||||
|
||||
Reference in New Issue
Block a user