Skip to content

Commit

Permalink
Merge branch '5.1.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
philwebb committed Jul 20, 2019
2 parents 9110a56 + e5bef10 commit be65bef
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,7 @@ public boolean isAssignableFrom(Class<?> other) {
}
@Override
public boolean isAssignableFrom(ResolvableType other) {
Class<?> otherClass = other.getRawClass();
Class<?> otherClass = other.resolve();
return (otherClass != null && (clazz == null || ClassUtils.isAssignable(clazz, otherClass)));
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,18 @@ public void forRawClassWithNull() throws Exception {
assertThat(type.isAssignableFrom(String.class)).isTrue();
}

@Test
public void forRawClassAssignableFromTypeVariable() { // gh-23321
ResolvableType typeVariable = ResolvableType.forClass(ExtendsList.class).as(List.class).getGeneric();
ResolvableType raw = ResolvableType.forRawClass(CharSequence.class);
assertThat(raw.resolve()).isEqualTo(CharSequence.class);
assertThat(typeVariable.resolve()).isEqualTo(CharSequence.class);
assertThat(raw.resolve().isAssignableFrom(typeVariable.resolve())).isTrue();
assertThat(typeVariable.resolve().isAssignableFrom(raw.resolve())).isTrue();
assertThat(raw.isAssignableFrom(typeVariable)).isTrue();
assertThat(typeVariable.isAssignableFrom(raw)).isTrue();
}

@Test
public void forInstanceMustNotBeNull() {
assertThatIllegalArgumentException().isThrownBy(() ->
Expand Down

0 comments on commit be65bef

Please sign in to comment.