Description
Bug has been introduced in Spaing Data JPA 2.6.1 which causes NPE to be thrown in org.springframework.data.jpa.repository.query.JpaQueryCreator when query result is projection-based interface or generic class with projection-based interface as type parameter.
Attached is simple diff file that changes org.springframework.data.jpa.repository.sample.UserRepository to demonstrate such behaviour.
While testing, if noticed that NPE is not thrown when line 181 in org.springframework.data.jpa.repository.query.JpaQueryCreator is changed from
Class<?> typeToRead = returnedType.getTypeToRead();
to
Class<?> typeToRead = returnedType.getReturnedType();
but I do not know is this can be proper fix or not.
[Additional "feature" is that this bug is causing test to throw NPE's in infinte loop]