Hi, I am the maintainer of `jackson-module-kotlin`...
# feed
w
Hi, I am the maintainer of
jackson-module-kotlin
. We are planning to release
Jackson 3.0.0-rc1
at the end of February. In 3.0, the default values of some options will be changed based on user discussions. Some of them are still open for voting, so please vote for them here. The
jackson-module-kotlin
is being voted on as well, so please check it out. • Enable `StrictNullChecks` by defaultEnable `SingletonSupport` by default Suggestions for new changes are also welcome.
👍 4
👍🏾 1
k
Just so I understand properly, what exactly does the documentation mean by "Deserializing a singleton overwrites the value of the single instance"? Which instance is overwritten? The Kotlin
object
itself or the instance that's just been deserialized?
w
I am not aware of what the intent of the
KotlinFeature.SingletonSupport
documentation was. However, even if it was the default, I would not rewrite the
INSTANCE
field. The only problem is that a new instance is created incorrectly each time it is deserialized.
k
Thanks for the reply. My worry was what would happen if you serialize a singleton Kotlin
object
and then you change the
object
and then deserialize it back. I guess in such cases there's no completely safe thing to do, and the developer should guard against such possibilities.
Another example that may cause unexpected behaviour:
Copy code
object DontDoThis {
    Instance appStartTime = Instance.now()
}
A naive programmer may think they could save a start time in a file by doing the above.