Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kotlin.jvm.internal.ArrayIterator serialization result is not as expected. #674

Closed
k163377 opened this issue May 6, 2023 · 1 comment
Closed
Labels

Comments

@k163377
Copy link
Contributor

k163377 commented May 6, 2023

Describe the bug
The Iterator serialization result is expected to be array-like.
On the other hand, the serialization result of kotlin.jvm.internal.ArrayIterator is not as expected.

To Reproduce

val mapper = ObjectMapper() // This problem is reproduced without kotlin-module

println(mapper.writeValueAsString(listOf("foo"))) // -> ["foo"]
println(mapper.writeValueAsString(arrayOf("foo"))) // -> ["foo"]
println(mapper.writeValueAsString(listOf("foo").iterator())) // -> ["foo"]
println(mapper.writeValueAsString(arrayOf("foo").iterator())) // -> {"array":["foo"]}

Versions
Kotlin: 1.5.32
Jackson-module-kotlin: 2.15.0
Jackson-databind: 2.15.0

Additional context
A change has been made in jackson-module-kotlin 2.15 regarding the serialization of Sequence.
On the other hand, this issue is causing the serialization result of Sequence declared with sequenceOf to not be as expected.

val mapper = jacksonObjectMapper()
println(mapper.writeValueAsString(listOf("foo").asSequence())) // -> ["foo"]
println(mapper.writeValueAsString(sequenceOf("foo"))) // -> {"array":["foo"]}

By #675, the problem with sequenceOf has been resolved in 2.15.2.

@k163377 k163377 added the bug label May 6, 2023
k163377 added a commit to k163377/jackson-module-kotlin that referenced this issue May 6, 2023
@k163377 k163377 changed the title kotlin.jvm.internal.ArrayIterator(sequenceOf(...) ) serialization result is not as expected. kotlin.jvm.internal.ArrayIterator(sequenceOf(...)) serialization result is not as expected. May 6, 2023
@k163377 k163377 changed the title kotlin.jvm.internal.ArrayIterator(sequenceOf(...)) serialization result is not as expected. kotlin.jvm.internal.ArrayIterator serialization result is not as expected. May 19, 2023
@k163377
Copy link
Contributor Author

k163377 commented Jun 4, 2023

Closed as duplicate #604.

@k163377 k163377 closed this as completed Jun 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant