Skip to content

Update to kotlinx-datetime:0.7.0 and fix binary incompatible changes.#1645

Merged
swankjesse merged 2 commits into
lysine-dev:masterfrom
colinrtwhite:colin/datetime_070
Jun 26, 2025
Merged

Update to kotlinx-datetime:0.7.0 and fix binary incompatible changes.#1645
swankjesse merged 2 commits into
lysine-dev:masterfrom
colinrtwhite:colin/datetime_070

Conversation

@colinrtwhite

@colinrtwhite colinrtwhite commented Jun 25, 2025

Copy link
Copy Markdown
Contributor

kotlinx-datetime:0.7.0 completely removes kotlinx.datetime.Clock and kotlinx.datetime.Instant in favour of the kotlin.time versions (more info). This creates a couple issues:

  • We currently use kotlinx.datetime.Instant in FakeFileSystem's public API. We probably have to take a binary incompatible change here and update to the new class.
  • kotlin.time classes are marked with @ExperimentalTime which will propagate to our FakeFileSystem's constructor unless we add a secondary constructor: constructor() : this(Clock.System) that hides the experimental arg.
  • Currently all okio consumers have to use 0.7.0-0.6.x-compat (a compat version that retains the removed classes) if they want to update to 0.7.0 and use FakeFileSystem.

@JakeWharton

Copy link
Copy Markdown
Collaborator

We probably have to take a binary incompatible change here and update to the new class.

I believe this was the concession when we originally took the unstable dependency. It's a test only dependency (or should be) so it's okay that we take this hit.

) : FileSystem() {

// Avoid propagating 'ExperimentalTime' if 'clock' is not specified.
constructor() : this(Clock.System)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it's worth maintaining this secondary constructor forever to avoid propagating @ExperimentalTime to FakeFileSystem(). Let me know what you think

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a good idea. We can do @JvmOverloads once this type goes stable.

@swankjesse swankjesse left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for all the attention to compatibility!

@swankjesse
swankjesse merged commit 24e3c84 into lysine-dev:master Jun 26, 2025
11 checks passed
@mathieularue

Copy link
Copy Markdown

Is there any chance that this will be included in an upcoming release? Thanks!

@JakeWharton

Copy link
Copy Markdown
Collaborator

It will be released today or tomorrow, yes.

@swankjesse

Copy link
Copy Markdown
Collaborator

When this build completes, the release is out. https://github.com/square/okio/actions/runs/15945624170

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants