Restore lenient match against unresolvable wildcard
Closes gh-33982
This commit is contained in:
@@ -334,19 +334,19 @@ public class ResolvableType implements Serializable {
|
||||
|
||||
// Deal with wildcard bounds
|
||||
WildcardBounds ourBounds = WildcardBounds.get(this);
|
||||
WildcardBounds typeBounds = WildcardBounds.get(other);
|
||||
WildcardBounds otherBounds = WildcardBounds.get(other);
|
||||
|
||||
// In the form X is assignable to <? extends Number>
|
||||
if (typeBounds != null) {
|
||||
if (otherBounds != null) {
|
||||
if (ourBounds != null) {
|
||||
return (ourBounds.isSameKind(typeBounds) &&
|
||||
ourBounds.isAssignableFrom(typeBounds.getBounds(), matchedBefore));
|
||||
return (ourBounds.isSameKind(otherBounds) &&
|
||||
ourBounds.isAssignableFrom(otherBounds.getBounds(), matchedBefore));
|
||||
}
|
||||
else if (upUntilUnresolvable) {
|
||||
return typeBounds.isAssignableFrom(this, matchedBefore);
|
||||
return otherBounds.isAssignableFrom(this, matchedBefore);
|
||||
}
|
||||
else if (!exactMatch) {
|
||||
return typeBounds.isAssignableTo(this, matchedBefore);
|
||||
return otherBounds.isAssignableTo(this, matchedBefore);
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
@@ -400,8 +400,8 @@ public class ResolvableType implements Serializable {
|
||||
if (checkGenerics) {
|
||||
// Recursively check each generic
|
||||
ResolvableType[] ourGenerics = getGenerics();
|
||||
ResolvableType[] typeGenerics = other.as(ourResolved).getGenerics();
|
||||
if (ourGenerics.length != typeGenerics.length) {
|
||||
ResolvableType[] otherGenerics = other.as(ourResolved).getGenerics();
|
||||
if (ourGenerics.length != otherGenerics.length) {
|
||||
return false;
|
||||
}
|
||||
if (ourGenerics.length > 0) {
|
||||
@@ -410,7 +410,8 @@ public class ResolvableType implements Serializable {
|
||||
}
|
||||
matchedBefore.put(this.type, other.type);
|
||||
for (int i = 0; i < ourGenerics.length; i++) {
|
||||
if (!ourGenerics[i].isAssignableFrom(typeGenerics[i], true, matchedBefore, upUntilUnresolvable)) {
|
||||
if (!ourGenerics[i].isAssignableFrom(otherGenerics[i],
|
||||
!other.hasUnresolvableGenerics(), matchedBefore, upUntilUnresolvable)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user