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

Emit Android min SDK 24 compatible code for Timestamp and Duration #14

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ scheme, and will be removed in the future. The legacy tags have a corresponding

----

### v0.3.2+v0.25.0

- **IMPORTANT**: Kotlin: for out of range Duration/Timestamp values passed into generated bindings,
throw `IllegalArgumentException` instead of `java.time.DateTimeException`. This brings down the
Android min SDK requirement from 26 to 24.

### v0.3.1+v0.25.0

- **IMPORTANT**: Fix memory leak in uniffi scaffolding when invoking callback.
Expand Down
2 changes: 1 addition & 1 deletion docs/release-process-nordsec.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ cargo install cargo-release
git checkout -b bump-X.Y.Z+vA.B.C
```

- Update changelog in [README.md](../README.md) to include the changes that were made since last
- Update changelog in [CHANGELOG.md](../CHANGELOG.md) to include the changes that were made since last
version. Commit the changelog with message `Update CHANGELOG.md`.

- Update version numbers in `Cargo.toml` files, creates a commit.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ public object FfiConverterDuration: FfiConverterRustBuffer<java.time.Duration> {
// Type mismatch (should be u32) but we check for overflow/underflow below
val nanoseconds = buf.getInt().toLong()
if (seconds < 0) {
throw java.time.DateTimeException("Duration exceeds minimum or maximum value supported by uniffi")
throw IllegalArgumentException("Duration exceeds minimum or maximum value supported by uniffi")
}
if (nanoseconds < 0) {
throw java.time.DateTimeException("Duration nanoseconds exceed minimum or maximum supported by uniffi")
throw IllegalArgumentException("Duration nanoseconds exceed minimum or maximum supported by uniffi")
}
return java.time.Duration.ofSeconds(seconds, nanoseconds)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ public object FfiConverterTimestamp: FfiConverterRustBuffer<java.time.Instant> {
// Type mismatch (should be u32) but we check for overflow/underflow below
val nanoseconds = buf.getInt().toLong()
if (nanoseconds < 0) {
throw java.time.DateTimeException("Instant nanoseconds exceed minimum or maximum supported by uniffi")
throw IllegalArgumentException("Instant nanoseconds exceed minimum or maximum supported by uniffi")
}
if (seconds >= 0) {
return java.time.Instant.EPOCH.plus(java.time.Duration.ofSeconds(seconds, nanoseconds))
Expand Down
Loading