Skip to content

Fix TypeName resolution of method return type #3374

@christophstrobl

Description

@christophstrobl

TypeNames.typeName does only return the name of the TypeVariable which is not sufficient in certain cases where we need to make sure to fully resolve the name.

Eg. like in the following scenario (also described in spring-projects/spring-data-jpa#4028).

public interface BaseRepository<T, ID> extends CrudRepository<T, ID> {

    T selectBy(ID id);

}
public interface SomeRepo extends BaseRepository<SomeType, Long> {

}



MethodParameter methodParameter = new MethodParameter(method, 0).withContainingClass(SomeRepo.class);
ResolvableType resolvableType = ResolvableType.forMethodParameter(methodParameter);

TypeNames.typeName(resolvableType) // -> ID

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions