Skip to content

Commit 2a98b31

Browse files
committed
Merge branch '6.2.x'
2 parents 52e01bb + 63c8e7c commit 2a98b31

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

Diff for: spring-core/src/main/java/org/springframework/core/ResolvableType.java

+6-4
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ else if (upUntilUnresolvable) {
334334
return otherBounds.isAssignableFrom(this, matchedBefore);
335335
}
336336
else if (!strict) {
337-
return (matchedBefore != null ? otherBounds.equalsType(this) :
337+
return (matchedBefore != null ? otherBounds.equalsType(this, matchedBefore) :
338338
otherBounds.isAssignableTo(this, matchedBefore));
339339
}
340340
else {
@@ -1775,11 +1775,13 @@ public boolean isAssignableTo(ResolvableType type, @Nullable Map<Type, Type> mat
17751775
* Return {@code true} if these bounds are equal to the specified type.
17761776
* @param type the type to test against
17771777
* @return {@code true} if these bounds are equal to the type
1778-
* @since 6.2.3
1778+
* @since 6.2.4
17791779
*/
1780-
public boolean equalsType(ResolvableType type) {
1780+
public boolean equalsType(ResolvableType type, @Nullable Map<Type, Type> matchedBefore) {
17811781
for (ResolvableType bound : this.bounds) {
1782-
if (!type.equalsType(bound)) {
1782+
if (this.kind == Kind.UPPER && bound.hasUnresolvableGenerics() ?
1783+
!type.isAssignableFrom(bound, true, matchedBefore, false) :
1784+
!type.equalsType(bound)) {
17831785
return false;
17841786
}
17851787
}

Diff for: spring-core/src/test/java/org/springframework/core/ResolvableTypeTests.java

+18
Original file line numberDiff line numberDiff line change
@@ -1527,6 +1527,12 @@ void gh33535() throws Exception {
15271527
assertThat(repository3.isAssignableFromResolvedPart(repository2)).isTrue();
15281528
}
15291529

1530+
@Test
1531+
void gh34541() throws Exception {
1532+
ResolvableType typeWithGenerics = ResolvableType.forField(getClass().getDeclaredField("paymentCreator"));
1533+
assertThat(typeWithGenerics.isAssignableFrom(PaymentCreator.class)).isTrue();
1534+
}
1535+
15301536

15311537
private ResolvableType testSerialization(ResolvableType type) throws Exception {
15321538
ByteArrayOutputStream bos = new ByteArrayOutputStream();
@@ -1928,6 +1934,18 @@ static class RecursiveMapWithInterface extends HashMap<String, RecursiveMapWithI
19281934
}
19291935

19301936

1937+
PaymentCreator<? extends Payment, PaymentCreatorParameter<? extends Payment>> paymentCreator;
1938+
1939+
static class PaymentCreator<T extends Payment, P extends PaymentCreatorParameter<T>> {
1940+
}
1941+
1942+
static class PaymentCreatorParameter<T extends Payment> {
1943+
}
1944+
1945+
abstract static class Payment {
1946+
}
1947+
1948+
19311949
private static class ResolvableTypeAssert extends AbstractAssert<ResolvableTypeAssert, ResolvableType>{
19321950

19331951
public ResolvableTypeAssert(ResolvableType actual) {

0 commit comments

Comments
 (0)