Commit 3a7603a
perf(android): Replace Date with unix timestamp in SentryNanotimeDate (JAVA-533) (#5550)
* perf(android): Replace Date with unix timestamp in SentryNanotimeDate (JAVA-533)
SentryNanotimeDate stored a java.util.Date but only ever read its epoch
millis. Storing the millis directly avoids a Calendar allocation on every
timestamp, which on Android backs every span/transaction timestamp.
The default constructor now uses System.currentTimeMillis() instead of
DateUtils.getCurrentDateTime() (Calendar with UTC). This is behavior-
preserving: the UTC TimeZone only affects calendar field access, not the
epoch-millis value the class used.
BREAKING: the public SentryNanotimeDate(Date, long) constructor is
replaced by SentryNanotimeDate(long unixDate, long nanos).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* changelog
* ref(android): Mark SentryNanotimeDate as @ApiStatus.Internal
SentryNanotimeDate is the legacy Date+nanoTime precision workaround and is
not intended for direct use by consumers. Marking it @ApiStatus.Internal
signals this and means the constructor change in this PR is not a public
API break per the repo's API policy.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* refactor(sentry): Rename unixDate field to unixDateMillis
Name the long field for its unit so it is clear it holds the unix
timestamp in milliseconds since the epoch.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* docs(changelog): Reword SentryNanotimeDate entry
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* feat(sentry): Restore deprecated SentryNanotimeDate Date constructor (JAVA-533)
The previous change replaced the (Date, long) constructor with a
(long, long) constructor, which was a breaking API change. Add the
Date constructor back, delegating to the millis-based one, and mark
it deprecated to steer callers toward the new constructor.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(sentry): Suppress InlineMeSuggester on deprecated constructor (JAVA-533)
Error Prone flagged the deprecated (Date, long) constructor as
inlineable, failing the build. Suppress the suggestion to match the
existing convention in Sentry.java, keeping the constructor available
for backwards compatibility.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(sentry): Suppress JavaUtilDate on deprecated constructor (JAVA-533)
Error Prone's JavaUtilDate check flagged date.getTime() in the
deprecated constructor, failing the build. Suppress it, matching the
existing suppression used elsewhere in this class.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 06b0d80 commit 3a7603a
16 files changed
Lines changed: 99 additions & 116 deletions
File tree
- sentry-android-core/src
- main/java/io/sentry/android/core
- test/java/io/sentry/android/core
- performance
- sentry-apache-http-client-5/src/test/kotlin/io/sentry/transport/apache
- sentry
- api
- src
- main/java/io/sentry
- test/java/io/sentry
- transport
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| |||
Lines changed: 2 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | 48 | | |
50 | 49 | | |
51 | 50 | | |
| |||
94 | 93 | | |
95 | 94 | | |
96 | 95 | | |
97 | | - | |
| 96 | + | |
98 | 97 | | |
99 | 98 | | |
100 | 99 | | |
| |||
729 | 728 | | |
730 | 729 | | |
731 | 730 | | |
732 | | - | |
| 731 | + | |
733 | 732 | | |
734 | 733 | | |
735 | 734 | | |
| |||
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | 16 | | |
18 | 17 | | |
19 | 18 | | |
| |||
33 | 32 | | |
34 | 33 | | |
35 | 34 | | |
36 | | - | |
| 35 | + | |
37 | 36 | | |
38 | 37 | | |
39 | 38 | | |
| |||
Lines changed: 33 additions & 34 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | 44 | | |
46 | 45 | | |
47 | 46 | | |
| |||
936 | 935 | | |
937 | 936 | | |
938 | 937 | | |
939 | | - | |
| 938 | + | |
940 | 939 | | |
941 | 940 | | |
942 | 941 | | |
| |||
961 | 960 | | |
962 | 961 | | |
963 | 962 | | |
964 | | - | |
| 963 | + | |
965 | 964 | | |
966 | 965 | | |
967 | 966 | | |
| |||
984 | 983 | | |
985 | 984 | | |
986 | 985 | | |
987 | | - | |
988 | | - | |
| 986 | + | |
| 987 | + | |
989 | 988 | | |
990 | 989 | | |
991 | 990 | | |
| |||
1011 | 1010 | | |
1012 | 1011 | | |
1013 | 1012 | | |
1014 | | - | |
| 1013 | + | |
1015 | 1014 | | |
1016 | 1015 | | |
1017 | 1016 | | |
| |||
1030 | 1029 | | |
1031 | 1030 | | |
1032 | 1031 | | |
1033 | | - | |
1034 | | - | |
| 1032 | + | |
| 1033 | + | |
1035 | 1034 | | |
1036 | 1035 | | |
1037 | 1036 | | |
| |||
1056 | 1055 | | |
1057 | 1056 | | |
1058 | 1057 | | |
1059 | | - | |
| 1058 | + | |
1060 | 1059 | | |
1061 | 1060 | | |
1062 | 1061 | | |
| |||
1080 | 1079 | | |
1081 | 1080 | | |
1082 | 1081 | | |
1083 | | - | |
| 1082 | + | |
1084 | 1083 | | |
1085 | 1084 | | |
1086 | 1085 | | |
| |||
1113 | 1112 | | |
1114 | 1113 | | |
1115 | 1114 | | |
1116 | | - | |
| 1115 | + | |
1117 | 1116 | | |
1118 | | - | |
| 1117 | + | |
1119 | 1118 | | |
1120 | 1119 | | |
1121 | 1120 | | |
| |||
1168 | 1167 | | |
1169 | 1168 | | |
1170 | 1169 | | |
1171 | | - | |
1172 | | - | |
| 1170 | + | |
| 1171 | + | |
1173 | 1172 | | |
1174 | 1173 | | |
1175 | 1174 | | |
| |||
1230 | 1229 | | |
1231 | 1230 | | |
1232 | 1231 | | |
1233 | | - | |
| 1232 | + | |
1234 | 1233 | | |
1235 | | - | |
| 1234 | + | |
1236 | 1235 | | |
1237 | 1236 | | |
1238 | 1237 | | |
| |||
1254 | 1253 | | |
1255 | 1254 | | |
1256 | 1255 | | |
1257 | | - | |
| 1256 | + | |
1258 | 1257 | | |
1259 | | - | |
| 1258 | + | |
1260 | 1259 | | |
1261 | 1260 | | |
1262 | 1261 | | |
| |||
1389 | 1388 | | |
1390 | 1389 | | |
1391 | 1390 | | |
1392 | | - | |
| 1391 | + | |
1393 | 1392 | | |
1394 | 1393 | | |
1395 | 1394 | | |
| |||
1415 | 1414 | | |
1416 | 1415 | | |
1417 | 1416 | | |
1418 | | - | |
| 1417 | + | |
1419 | 1418 | | |
1420 | 1419 | | |
1421 | 1420 | | |
| |||
1439 | 1438 | | |
1440 | 1439 | | |
1441 | 1440 | | |
1442 | | - | |
| 1441 | + | |
1443 | 1442 | | |
1444 | 1443 | | |
1445 | 1444 | | |
| |||
1474 | 1473 | | |
1475 | 1474 | | |
1476 | 1475 | | |
1477 | | - | |
| 1476 | + | |
1478 | 1477 | | |
1479 | 1478 | | |
1480 | 1479 | | |
| |||
1988 | 1987 | | |
1989 | 1988 | | |
1990 | 1989 | | |
1991 | | - | |
| 1990 | + | |
1992 | 1991 | | |
1993 | 1992 | | |
1994 | 1993 | | |
1995 | 1994 | | |
1996 | 1995 | | |
1997 | 1996 | | |
1998 | | - | |
| 1997 | + | |
1999 | 1998 | | |
2000 | 1999 | | |
2001 | 2000 | | |
| |||
2019 | 2018 | | |
2020 | 2019 | | |
2021 | 2020 | | |
2022 | | - | |
| 2021 | + | |
2023 | 2022 | | |
2024 | 2023 | | |
2025 | 2024 | | |
| |||
2036 | 2035 | | |
2037 | 2036 | | |
2038 | 2037 | | |
2039 | | - | |
2040 | | - | |
| 2038 | + | |
| 2039 | + | |
2041 | 2040 | | |
2042 | 2041 | | |
2043 | 2042 | | |
| |||
2076 | 2075 | | |
2077 | 2076 | | |
2078 | 2077 | | |
2079 | | - | |
| 2078 | + | |
2080 | 2079 | | |
2081 | 2080 | | |
2082 | 2081 | | |
| |||
2134 | 2133 | | |
2135 | 2134 | | |
2136 | 2135 | | |
2137 | | - | |
2138 | | - | |
| 2136 | + | |
| 2137 | + | |
2139 | 2138 | | |
2140 | 2139 | | |
2141 | 2140 | | |
| |||
2187 | 2186 | | |
2188 | 2187 | | |
2189 | 2188 | | |
2190 | | - | |
2191 | | - | |
| 2189 | + | |
| 2190 | + | |
2192 | 2191 | | |
2193 | 2192 | | |
2194 | 2193 | | |
| |||
2209 | 2208 | | |
2210 | 2209 | | |
2211 | 2210 | | |
2212 | | - | |
| 2211 | + | |
2213 | 2212 | | |
2214 | 2213 | | |
2215 | 2214 | | |
| |||
2290 | 2289 | | |
2291 | 2290 | | |
2292 | 2291 | | |
2293 | | - | |
| 2292 | + | |
2294 | 2293 | | |
2295 | 2294 | | |
2296 | 2295 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
| |||
54 | 53 | | |
55 | 54 | | |
56 | 55 | | |
57 | | - | |
58 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| |||
Lines changed: 8 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | 11 | | |
13 | 12 | | |
14 | 13 | | |
| |||
50 | 49 | | |
51 | 50 | | |
52 | 51 | | |
53 | | - | |
| 52 | + | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
| 73 | + | |
73 | 74 | | |
74 | 75 | | |
75 | 76 | | |
76 | | - | |
| 77 | + | |
77 | 78 | | |
78 | 79 | | |
79 | 80 | | |
| |||
438 | 439 | | |
439 | 440 | | |
440 | 441 | | |
441 | | - | |
442 | | - | |
| 442 | + | |
| 443 | + | |
443 | 444 | | |
444 | 445 | | |
445 | 446 | | |
| |||
0 commit comments