FasterXML / FasterXML/jackson-module-kotlin
`kotlin.jvm.internal.ArrayIterator` serialization result is not as expected.
- Dominant language
- Kotlin
- Stars
- 1.2k
- Forks
- 187
- Avg merge
- 9h 48m
- Merged PRs (30d)
- 16
Description
**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**
```kotlin
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.
```kotlin
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.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.