Skip to content

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

Closed
@spring-projects-issues

Description

@spring-projects-issues

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 {

	@Test
	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

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)status: backportedAn issue that has been backported to maintenance branchestype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions