Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ResolvableType for a raw type is not assignable to generic types of the same class [SPR-14648] #19214

spring-projects-issues opened this issue Aug 31, 2016 · 1 comment


Copy link

@spring-projects-issues spring-projects-issues commented Aug 31, 2016

Oliver Drotbohm opened SPR-14648 and commented

This test case fails for me and I think it shouldn't as a concrete generic type should always be assignable to a raw variant of it:

public class RawTypeAssignmentTests {

	public void rawTypeShouldBeassignable() throws Exception {

		// That works.
		Collection value = someMethod();
		// So that should, too.
		ResolvableType fromClass = ResolvableType.forClass(Collection.class);
		ResolvableType fromReturnType = ResolvableType.forMethodReturnType(RawTypeAssignmentTests.class.getMethod("someMethod"));

		assertThat(fromClass.isAssignableFrom(fromReturnType), is(true));

	public Collection<?> someMethod() {
		return Collections.emptyList();

Affects: 4.2.7, 4.3.2, 5.0 M1

Issue Links:

  • DATAREST-881 ResourceProcessor is not invoked if RepositoryEntityController does not return a subtype of Resources ("is depended on by")

Backported to: 4.2.8

Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Aug 31, 2016

Juergen Hoeller commented

The snippet above should be using ResolvableType.forRawClass(Class), then it should indeed be working. However, it is only actually working with ResolvableType.isAssignableFrom(Class) then, not with ResolvableType.isAssignableFrom(ResolvableType). I've fixed that gap for 4.3.3 / 4.2.8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants