Skip to content

KotlinSerializationJsonEncoder can't encode java.util.Collections$SingletonList #34966

Closed as not planned
@ashershnov

Description

@ashershnov

Hello,
could you please look into this issue?

Should org.springframework.http.codec.json.KotlinSerializationJsonEncoder be able to serialize instances of java.util.Collections$SingletonList to JSON?

Here is a piece of code showing that it's not:
Image

The output is:
KotlinSerializationJsonEncoder can encode: false
Jackson2JsonEncoder can encode: true

In org.springframework.http.codec.KotlinSerializationSupport, serializer(ResolvableType) always returns null in this context:
Image

Versions used:
Spring Boot 3.4.6
Spring WebFlux 6.2.7
Spring Web 6.2.7
Kotlinx serialization json 1.8.1

Please find attached the project for reproducing:
webflux.zip

Could it be a bug?

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)status: invalidAn issue that we don't feel is validtheme: kotlinAn issue related to Kotlin support

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions