Comments (12)
Please attach reproducible code.
Also, please check the com.fasterxml.jackson.module.kotlin.PackageVersion
at runtime.
As mentioned above, the version of KotlinModule
may have been overwritten at runtime.
If not, you should get 2.17.x.
from jackson-module-kotlin.
Sorry I can't because it is company code.
However, I figured it out. Turns out my dependency tree was different in runtime and compile time somehow. The reason why I never realized this is that spring gradle plugin enforces a certain version of kotlin and it basically overrides everything that you specify in dependencies block. The only solution is to add the following,
configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group.startsWith("com.fasterxml.jackson")) {
details.useVersion("2.17.0")
}
}
}
from jackson-module-kotlin.
@be-hase
I was mistaken on this issue.
I assumed that Kotlin
would prioritise the use of non-default functions, but unfortunately this is not the case.
https://youtrack.jetbrains.com/issue/KT-17300
As you say, this was unintentionally breaking compatibility.
I will look into fixing this over the weekend if possible.
from jackson-module-kotlin.
Thanks.
I did a little research and it doesn't look like there is a good way to do it...
The only way might be to write the overload by hand.
from jackson-module-kotlin.
This will be fixed in the next release.
from jackson-module-kotlin.
FYI, ObjectMapper().registerModule(kotlinModule())
where kotlinModule
is imported as com.fasterxml.jackson.module.kotlin.kotlinModule
seems to work. kotlinModule
does not carry @JvmOverloads
so maybe that's related?
from jackson-module-kotlin.
From the error message, it looks like you are running code compiled with 2.17
on a version less than 2.17
.
Can you confirm which version is being used at runtime?
Or more information is needed.
from jackson-module-kotlin.
I am having the same issue, I am almost certain our runtime versions are up-to-date and 2.17.
from jackson-module-kotlin.
Thanks for the verification.
Anyway, it seems that there is no problem with jackson-module-kotlin
, so this issue is closed.
from jackson-module-kotlin.
And fwtw, Jackson 2.17.1 was just released today. Probably won't change behavior here but just in case, upgrade strongly recommended (from 2.17.0).
from jackson-module-kotlin.
@k163377
Did jackson intentionally make the compatibility loss from version 2.17?
Spring boot users often tend to use BOM to fix version.
(using dependency-management-plugin, gradle constraints, etc...)
The latest spring boot BOM is still jackson 2.15.4, so I think there are many cases in the JVM community where code compiled with 2.17.x is used in older jackson environments.
If there is a reason for the loss of compatibility, we should accept, but if the loss of compatibility is unintentional?
The reproduction code is available here.
https://github.com/be-hase/jackson-issue-202405
from jackson-module-kotlin.
thanks :)
from jackson-module-kotlin.
Related Issues (20)
- Incosistent behaviour with a single field
- Field proliferation bug when using ObjectMapper in Kotlin HOT 2
- @JsonProperty ignored when serialising Kotlin @JvmRecord in 2.16.X HOT 3
- Excessive memory usage when using KotlinModule with Kotlin data class HOT 2
- Cannot use value class as map key in 2.17 HOT 8
- Can't compute ClassId for primitive type: int HOT 5
- Create 2.18 branch HOT 1
- How to disable the feature who rename a primitive boolean "isXXX" to "XXX" HOT 1
- Property enabledSingletonSupport - deprecated but with wrong template HOT 2
- Field with value class typ ignoring JsonProperty binding HOT 1
- Custom deserializer of inlined value class (with delegate) HOT 3
- 2.18 build on JDK 8 fails CI HOT 2
- Kotlin Module interferes with Java record deserialization HOT 4
- Missing classes error using AGP 8 R8 shrinker HOT 1
- Boolean property setter is skipped if name isX prefixed HOT 3
- CSV deserialization fails for targets with value class field when column reordering is enabled HOT 4
- Now failing test in 2.18 after Property Introspection Rewrite HOT 1
- See if there is benefit from integrating with jackson-databind better wrt detecting "default" Constructor for Kotlin (data) classes HOT 8
- Return multiple missing kotlin parameters at once
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jackson-module-kotlin.