You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 171be16
Browse filesBrowse the repository at this point in the historyBrowse files
fix: Remove java.time.Duration usage from FDv2 goodbye parsing (#273)
**Requirements**
- [x] I have added test coverage for new or changed functionality
- [x] I have followed the repository's [pull request submission
guidelines](../blob/main/CONTRIBUTING.md#submitting-pull-requests)
- [ ] I have validated my changes against all supported platform
versions
**Related issues**
Follow-up to #265. Android consumes this library
(android-client-sdk#435); `java.time.Duration` is only available
natively on API 26+, and Android supports API 21 without core-library
desugaring.
**Describe the solution you've provided**
`Goodbye` and `FDv2ProtocolHandler` in `lib/shared/internal` now store
`protocolFallbackTTL` as a nullable `Long` of milliseconds instead of a
`Duration`. The wire format (seconds) is unchanged.
Internal API changes:
- `Goodbye.getProtocolFallbackTTL()` (returned `Duration`) is replaced
by `getProtocolFallbackTTLMillis()` (returns `Long`).
- The two-argument constructors take a `Long` of milliseconds; the
one-argument constructors are unchanged.
Neither the Java server SDK nor the Android SDK calls the old getter.
The compiled production classes in the module have no `java.time`
references.
**Describe alternatives you've considered**
Keeping the `Duration` getter alongside a millis accessor. That still
leaves `Duration` in the parse path, which is what runs on Android.
**Additional context**
Ran `FDv2PayloadsTest` and `FDv2ProtocolHandlerTest` plus the rest of
the module's JUnit tests directly: 324 passing. Local Gradle/Checkstyle
was blocked by Maven Central rate limiting, so CI is the check for
those.
Link to Devin session:
https://app.devin.ai/sessions/2540f086f1ea4dfba1470051465fb0fd
Open in Devin Desktop:
https://app.devin.ai/desktop/session/2540f086f1ea4dfba1470051465fb0fd?variant=devin
Requested by: @kinyoklion
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Overview**
> FDv2 **goodbye** handling no longer uses `java.time.Duration` for
`protocolFallbackTTL`. **`Goodbye`** and
**`FDv2ProtocolHandler.FDv2ActionGoodbye`** now hold a nullable **`Long`
in milliseconds**, with wire JSON still expressed in **seconds** via the
existing `FallbackTTLAdapter` (malformed values still map to **0**).
>
> The public internal API rename is **`getProtocolFallbackTTL()` →
`getProtocolFallbackTTLMillis()`**, and constructors that took a
`Duration` take millis instead. Tests in **`FDv2PayloadsTest`** and
**`FDv2ProtocolHandlerTest`** expect millis values and add coverage that
Gson serializes TTL back to seconds (e.g. 1250 ms → `1.25`).
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
1f5fe34. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
0 commit comments