Title: Deprecate the legacy clock and date-provider APIs · Issue #6586 · getsentry/sentry-java · GitHub
Open Graph Title: Deprecate the legacy clock and date-provider APIs · Issue #6586 · getsentry/sentry-java
X Title: Deprecate the legacy clock and date-provider APIs · Issue #6586 · getsentry/sentry-java
Description: This is step 1.3 of the project's Mini Plan. Mark the old clock APIs as deprecated on main, so users get at least one release of warnings before v9 removes them (#6506). #5574 was closed when the new io.sentry.time API merged (#6028), bu...
Open Graph Description: This is step 1.3 of the project's Mini Plan. Mark the old clock APIs as deprecated on main, so users get at least one release of warnings before v9 removes them (#6506). #5574 was closed when the n...
X Description: This is step 1.3 of the project's Mini Plan. Mark the old clock APIs as deprecated on main, so users get at least one release of warnings before v9 removes them (#6506). #5574 was closed when t...
Opengraph URL: https://github.com/getsentry/sentry-java/issues/6586
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Deprecate the legacy clock and date-provider APIs","articleBody":"This is step 1.3 of the project's Mini Plan. Mark the old clock APIs as deprecated on main, so users get at least one release of warnings before v9 removes them (getsentry/sentry-java#6506).\n\ngetsentry/sentry-java#5574 was closed when the new `io.sentry.time` API merged (#6028), but the deprecation never landed. Draft PR #6043 did the work. It is two months old and conflicts with main, so rebase it or redo it.\n\n## What to deprecate\n\n| API | Replacement |\n| -- | -- |\n| `ICurrentDateProvider.getCurrentTimeMillis()` | `Stopwatch` or `Deadline` for an interval, `options.getEpochClock()` for an instant |\n| `CurrentDateProvider.getInstance()` | `options.getEpochClock()` |\n| `DateUtils.getCurrentDateTime()` | `options.getEpochClock()` |\n| `AndroidDateUtils.getCurrentSentryDateTime()` | `options.getDateProvider()` until getsentry/sentry-java#6506 moves span timing |\n\n`AndroidCurrentDateProvider.getInstance()` is already deprecated (getsentry/sentry-java#6102).\n\nThe replacements follow \"Measuring Time\" in `AGENTS.md`. #6043 pointed instants at `SentryDateProvider`, which `AGENTS.md` now lists as legacy.\n\n## Constraints\n\n* Put `@Deprecated` on the members, not on the types. The Android modules compile at Java 8 with `-Werror`, and javac there warns on every import of a deprecated type. A class-level `@SuppressWarnings` doesn't cover imports.\n* Each call site that still needs a deprecated member gets `@SuppressWarnings(\"deprecation\")` and a comment naming the ticket that moves it.\n* No behavior change and no `.api` diff.\n\n## Open question\n\n`AGENTS.md` also lists `SentryDateProvider` as legacy. `SentryOptions.setDateProvider` is `@ApiStatus.Internal`, and the provider still drives span timestamps until getsentry/sentry-java#6506. Decide whether to deprecate it here or leave it to v9.\n\n## Done when\n\n* The members above are `@Deprecated`, and their Javadoc names the replacement.\n* Main builds with `-Werror`.\n* The changelog lists the deprecations.\n\n\u003cdetails>\u003csummary>Agent notes\u003c/summary>\n\nVerified on `main` at `812682636b` (2026-11-12).\n\n* #6043 branch: `no/java-571-deprecate-date-providers`. Its description explains the member-vs-type choice and the Java 8 import warning (JEP 211 only elides it from source 9 on).\n* Land getsentry/sentry-java#6583 first if possible. It removes the `CurrentDateProvider` uses in AnrV2, Tombstone, MemoryLimiter and okhttp, so fewer suppressions are needed here.\n* Kotlin call sites (`sentry-android-replay`, `sentry-okhttp`) only warn, because `-Werror` applies to `JavaCompile`. Recheck after getsentry/sentry-java#6522 (#6542) lands, since it changes the replay call sites.\n* Remaining `DateUtils.getCurrentDateTime()` callers on main: `Breadcrumb`, `SentryEvent`, `Session`, `SentryReplayEvent`, `ProfilingTraceData`, `EnvelopeCache`, `ClientReportRecorder`, `AndroidProfiler`, `AndroidTransactionProfiler`, replay `BaseCaptureStrategy`.\n* Remaining `AndroidDateUtils.getCurrentSentryDateTime()` callers: `ActivityLifecycleIntegration` (4), `ActivityLifecycleSpanHelper`.\n\n\u003c/details>","author":{"url":"https://github.com/runningcode","@type":"Person","name":"runningcode"},"datePublished":"2026-11-12T08:18:56Z","url":"https://github.com/getsentry/sentry-java/issues/6586"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:8096ffdd-1d86-2c03-5b06-932e955ff844 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 905C:34DD9:14440AC:1CA78C5:6B045E8D |
| html-safe-nonce | 54757faa0be12deb54b983c8f7294b197d87147f816c127d00b55e51e7103ad3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MDVDOjM0REQ5OjE0NDQwQUM6MUNBNzhDNTo2QjA0NUU4RCIsInZpc2l0b3JfaWQiOiI2OTkyNDI5NjQyNzE2MzA3MDg1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 1458bf5cbe04318c65418523a30fadbb8935bff05842eb066ca6125000d4cc2d |
| hovercard-subject-tag | issue:6345782988 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-java/6586/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bf3d2afcc3b8e87f7c45290668e6c55e38a47620321b38b6254755a62489ba31/getsentry/sentry-java/issues/6586 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bf3d2afcc3b8e87f7c45290668e6c55e38a47620321b38b6254755a62489ba31/getsentry/sentry-java/issues/6586 |
| og:image:alt | This is step 1.3 of the project's Mini Plan. Mark the old clock APIs as deprecated on main, so users get at least one release of warnings before v9 removes them (#6506). #5574 was closed when the n... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | runningcode |
| hostname | github.com |
| expected-hostname | github.com |
| None | 2d58451b4bcb73c33c67bfb6b28fb75fe6d5e279daf9b560fa4fd832f3d8c9a6 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-java git https://github.com/getsentry/sentry-java.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3368190 |
| octolytics-dimension-repository_nwo | getsentry/sentry-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3368190 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 03e114520787ad27289207f153520ef97461127c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width