Fixes: #30405

Comment From: pivotal-cla

@alpeshvas Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

Comment From: pivotal-cla

@alpeshvas Thank you for signing the Contributor License Agreement!

Comment From: alpeshvas

@sdeleuze bumping up.

Comment From: snicoll

@alpeshvas please don't do that. The team is busy on other things at the moment and we'll review this as soon as we can.

Comment From: alpeshvas

@alpeshvas please don't do that. The team is busy on other things at the moment and we'll review this as soon as we can.

Noted ✅

Comment From: sdeleuze

@alpeshvas Could you please clarify the following points:

The class sealed class APIResponse<T>(httpStatus: HttpStatus) : ResponseEntity<APIResponse<T>>(httpStatus) seems to use recursive generics, which produces some Stackoverflow exception during logging and I am not sure this is something we support or recommend on a special type like ResponseEntity<T>. Could you please update the unit test and/or your reproducer.

In the related issue, multiple versions are mentions as working correctly. Could you please clarify in which version of Spring Boot / Spring Framework the use case is working correctly?

Comment From: alpeshvas

Could you please update the unit test and/or your reproducer.

Updated, this is the unit test in my reproducer which is failing @sdeleuze, which should be passing. https://github.com/alpeshvas/spring-list-deserialization-issue/blob/dcaa3f7288a5b7f67747fe8cf88eca97519ad933/src/test/kotlin/com/example/springlistdeserializationissue/ControllerTests.kt#L24

Comment From: alpeshvas

In https://github.com/spring-projects/spring-framework/issues/30405, multiple versions are mentions as working correctly. Could you please clarify in which version of Spring Boot / Spring Framework the use case is working correctly?

@sdeleuze same code is working find in <=2.5.5, have added a branch in reproducer for you to check here - https://github.com/alpeshvas/spring-list-deserialization-issue/pull/1

Spring Deserialization fails for ResponseEntity with more than two level of generics

Comment From: sdeleuze

@alpeshvas As far as I can tell, the reproducer is still using sealed class APIResponse<T>(httpStatus: HttpStatus) : ResponseEntity<APIResponse<T>>(httpStatus) which is a recursive generic type using ResponseEntity<T> which is not something expected to be supported. Please provide a reproducer that does not involve recursive generic type using ResponseEntity<T>.

Comment From: alpeshvas

@alpeshvas As far as I can tell, the reproducer is still using sealed class APIResponse<T>(httpStatus: HttpStatus) : ResponseEntity<APIResponse<T>>(httpStatus) which is a recursive generic type using ResponseEntity<T> which is not something expected to be supported. Please provide a reproducer that does not involve recursive generic type using ResponseEntity<T>.

But recursive generic type used to work earlier (in 2.5.5 and earlier version - https://github.com/alpeshvas/spring-list-deserialization-issue/pull/1) I was expecting it to continue working.

Comment From: sdeleuze

As far as I can tell, it only worked for suspending functions with Spring Framework 5.3.10 or earlier in WebFlux due to a side effect of a bug fixed by #27292. I don't think it ever worked with WebFlux without suspending function, could you please confirm?

My analysis shows methodParameter().nested(), methodParameter().nested().nested() or methodParameter().nested().nested() always returns APIResponse<T>, hence the fact the nested type is never reached. That's by design because of the recursive generic type.