Skip to content

Replace KotlinBodySpec with proper ResponseSpec extensions #28144

Closed
@sdeleuze

Description

@sdeleuze

Due to #20606, we had to introduce KotlinBodySpec in Spring Framework 5.0.x in order to unlock Kotlin developers for most common use cases of WebTestClient in Kotlin.

As of Kotlin 1.6, the related Kotlin issue on recursive generic types has been fixed, making it possible for Spring Framework to provide regular reified extensions for ResponseSpec methods that takes a ParameterizedTypeReference (to be verified of course, but that's my current understanding).

As a consequence, my proposal is in Spring Framework 6 to remove KotlinBodySpec, as well as the current inline fun <reified B : Any> ResponseSpec.expectBody(): KotlinBodySpec<B> extension, and introduce regular reified extensions for ResponseSpec.expectBody since ResponseSpec.expectBodyList, ResponseSpec.returnResult extensions already exists.

This is a breaking change, I am afraid impossible to avoid, so it should be mentioned in the release notes. I am not sure we should deprecate the related extension in Spring Framework 5.3 since we need to support Kotlin 1.5 there and the current extension prevent to introduce the new proper one describe in this issue.

Metadata

Metadata

Assignees

Labels

in: testIssues in the test moduletheme: kotlinAn issue related to Kotlin supporttype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions