-
Notifications
You must be signed in to change notification settings - Fork 91
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
Implement java.io.Serializable for some of the classes #373
base: master
Are you sure you want to change the base?
Conversation
e803d80
to
75a14a6
Compare
Can you please merge this commit if possible? @ilya-g |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For better control over serialized representation I would suggest using writeReplace/readResolve with an Externalizable container.
core/jvm/src/Instant.kt
Outdated
@@ -111,6 +113,25 @@ public actual class Instant internal constructor(internal val value: jtInstant) | |||
|
|||
internal actual val MIN: Instant = Instant(jtInstant.MIN) | |||
internal actual val MAX: Instant = Instant(jtInstant.MAX) | |||
|
|||
@JvmStatic | |||
private val serialVersionUID: Long = 1L |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We usually use const val
for that.
I don't understand the idea. Do you mean that From the docs (https://docs.oracle.com/javase%2F7%2Fdocs%2Fapi%2F%2F/java/io/Externalizable.html):
But we don't have public no-arg constructors. I guess we could do something like |
A very necessary implementation on Android to be able to pass |
@akhbulatov, it's not "necessary", just convenient: see #143 (comment) |
75a14a6
to
9fc52b6
Compare
Implement java.io.Serializable for * Instant * LocalDate * LocalTime * LocalDateTime * UtcOffset TimeZone is not `Serializable` because its behavior is system-dependent. We can make it `java.io.Serializable` later if there is demand. We are using string representations instead of relying on Java's entities being `java.io.Serializable` so that we have more freedom to change our implementation later. Fixes #143
9fc52b6
to
32c9cc0
Compare
Implement java.io.Serializable for
TimeZone is not
Serializable
because its behavior is system-dependent. We can make itjava.io.Serializable
later if there is demand.We are using string representations instead of relying on Java's entities being
java.io.Serializable
so that we have more freedom to change our implementation later.Fixes #143