Skip to content

Nullable type used in vararg leads to compilation failure #34221

Closed
@snicoll

Description

@snicoll

I have this Kotlin code using Spring Boot 3/Spring Framework 6.2:

fun someRestCall(name: String?): Details {
	return restClient.get().uri("/{name}/details", name).retrieve().body(Details::class.java)!!
}

Where uri takes a String and a vararg of Object.

Upgrading to Spring Framework 7, I am getting:

MyService.kt:35:49 Argument type mismatch: actual type is 'kotlin.String?', but 'kotlin.Any' was expected.

I upgraded to Kotlin 2.1 in a separate commit so it looks like the extra checks might come from Spring Framework 7.0 itself. The new behavior looks more correct to me but I am wondering why it isn't failing in 6.x.

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: taskA general task

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions