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

Ignore open-ended ranges in KotlinMixins.kt (to help with Kotlin 1.7.20+) #582

Closed
poutsma opened this issue Sep 30, 2022 · 5 comments
Closed
Labels

Comments

@poutsma
Copy link

poutsma commented Sep 30, 2022

Kotlin 1.7.20 introduced "Open-ended ranges", see https://youtrack.jetbrains.com/issue/KT-52932.
As a consequence, writing a Kotlin Range now writes not just the start and end properties, but also endExclusive.

To Reproduce

val mapper: ObjectMapper = ObjectMapper().registerModule(KotlinModule.Builder().build())
println(mapper.writeValueAsString(IntRange(1,3)))

will print out {"start":1,"end":3,"endExclusive":4}.

Expected behavior
The above code should print out {"start":1,"end":3}.

Versions
Kotlin: 1.7.20
Jackson-module-kotlin: 2.13.4
Jackson-databind: 2.13.4

Suggested solution
Add @JsonIgnore abstract public fun getEndExclusive(): T to KotlinMixins.kt

@poutsma poutsma added the bug label Sep 30, 2022
bclozel added a commit to spring-projects/spring-framework that referenced this issue Sep 30, 2022
This commit also temporarily changes a test assertion for the Jackson
Kotlin module.
As of https://youtrack.jetbrains.com/issue/KT-52932, Kotlin enhanced the
`IntRange` and this change is not supported yet by the Jackson Kotlin
module. An issue has been reported here:
FasterXML/jackson-module-kotlin#582

Closes gh-29225
@cowtowncoder
Copy link
Member

@poutsma @Spikhalskiy Looks like we have two PRs -- #583 and #589 -- solving this. To me #583 looks preferable but wanted to see WDYT. Would be happy to merge either one but preferably while someone else sanity checks the fix (I have no specific concerns but as the general procedure).

@cowtowncoder cowtowncoder changed the title Ignore open-ended ranges in KotlinMixins.kt Ignore open-ended ranges in KotlinMixins.kt (to help with Kotlin 1.7.20+) Oct 23, 2022
cowtowncoder added a commit that referenced this issue Oct 23, 2022
@cowtowncoder
Copy link
Member

Fixed via #583, will go in 2.14.0-rc3

@cowtowncoder
Copy link
Member

I will also backport this in 2.13 (for 2.13.5) -- partly to get CI not to fail against kotlin-core 1.7.

cowtowncoder added a commit that referenced this issue Oct 27, 2022
cowtowncoder added a commit that referenced this issue Oct 27, 2022
@poutsma
Copy link
Author

poutsma commented Oct 31, 2022

I can confirm that this is fixed in 2.14.0-rc3. Thanks!

poutsma added a commit to spring-projects/spring-framework that referenced this issue Oct 31, 2022
This commit upgrades Jackson to 2.14.0-rc3, which resolves two
outstanding issues Spring Framework had with rc2. This commit reverts
the changes made due to those issues, see
FasterXML/jackson-core#824, and
FasterXML/jackson-module-kotlin#582.

Closes gh-29405
@cowtowncoder
Copy link
Member

Thank you for confirming @poutsma !

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

2 participants