Commit f202c3b
authored
feat: introduce
## In this PR:
* Modify publicly exposed methods to offer a `java.time` alternative
(suffixed with `Duration`). These methods will now hold the actual
implementation, whereas the old signatures will encapsulate the new
ones. Example: `retryDelay(org.threeten.bp.Duration)` encapsulates
`retryDelayDuration(java.time.Duration)`
## Notes
### _CLIRR_
```
[ERROR] 7012: com.google.cloud.testing.BaseEmulatorHelper$EmulatorRunner: Method 'public int waitForDuration(java.time.Duration)' has been added to an interface
```
This new interface method was added. However, we ignore this change
alert because the method has a `default` implementation.
### Addressing a behavior change in `Timestamp`
#### Problem
When using java.time functions, parsing a datetime string with offset
produces a wrong time object (offset is not added to the effective epoch
seconds).
#### Context
Full context in
https://github.com/googleapis/sdk-platform-java/pull/3330/files#r1828424787
adoptium/jdk@c6d209b
was introduced as a fix (in Java 9) meant for [this
issue](https://bugs.openjdk.org/browse/JDK-8066982).
In java 8, this means that the offset value is stored separately in a
variable that is not respected by the parsing functions before this fix.
The workaround is to use `appendZoneOrOffsetId()`, which stores the
offset value in the `zone` variable of a parsing context, which is
[respected as of java
8](https://github.com/adoptium/jdk8u/blob/31b88042fba46e87fba83e8bfd43ae0ecb5a9afd/jdk/src/share/classes/java/time/format/Parsed.java#L589-L591).
Additionally, under the consideration of this having unwanted side
effects, we expanded the test suite to test for more edge and normal
cases using an offset string. We also
[searched](https://bugs.openjdk.org/browse/JDK-8202948?jql=affectedVersion%20%3D%20%228%22%20AND%20text%20~%20%22offset%22)
the JDK's issue tracking database and found somewhat similar issues with
parsing and offsets but no workaround that addressed our specific
situation. This is also cause of no backports of the
[fix](adoptium/jdk@c6d209b)
for Java 9 into Java 8.
#### Outcome
The behavior is kept the same as stated by our tests and downstream
checksjava.time to java-core (#3330)1 parent c624b89 commit f202c3b
File tree
9 files changed
+247
-59
lines changed- java-core/google-cloud-core
- src
- main/java/com/google/cloud
- testing
- test/java/com/google/cloud
- testing
9 files changed
+247
-59
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
15 | 21 | | |
Lines changed: 29 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | | - | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
54 | | - | |
55 | | - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
56 | 63 | | |
57 | 64 | | |
58 | 65 | | |
59 | | - | |
60 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
61 | 74 | | |
62 | 75 | | |
63 | 76 | | |
| |||
66 | 79 | | |
67 | 80 | | |
68 | 81 | | |
69 | | - | |
70 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
71 | 90 | | |
72 | 91 | | |
73 | 92 | | |
| |||
124 | 143 | | |
125 | 144 | | |
126 | 145 | | |
127 | | - | |
| 146 | + | |
128 | 147 | | |
129 | 148 | | |
130 | | - | |
| 149 | + | |
131 | 150 | | |
132 | 151 | | |
133 | 152 | | |
134 | 153 | | |
135 | 154 | | |
136 | | - | |
| 155 | + | |
137 | 156 | | |
138 | 157 | | |
139 | 158 | | |
| |||
Lines changed: 6 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
73 | | - | |
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| |||
787 | 787 | | |
788 | 788 | | |
789 | 789 | | |
790 | | - | |
791 | | - | |
| 790 | + | |
| 791 | + | |
792 | 792 | | |
793 | | - | |
794 | | - | |
| 793 | + | |
| 794 | + | |
795 | 795 | | |
796 | | - | |
| 796 | + | |
797 | 797 | | |
798 | 798 | | |
799 | 799 | | |
| |||
Lines changed: 21 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
23 | 31 | | |
24 | 32 | | |
25 | 33 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| |||
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
57 | | - | |
| 58 | + | |
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
| |||
189 | 190 | | |
190 | 191 | | |
191 | 192 | | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
192 | 204 | | |
193 | 205 | | |
194 | 206 | | |
| |||
198 | 210 | | |
199 | 211 | | |
200 | 212 | | |
201 | | - | |
| 213 | + | |
202 | 214 | | |
203 | 215 | | |
204 | 216 | | |
| |||
Lines changed: 49 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
19 | 22 | | |
20 | 23 | | |
| 24 | + | |
21 | 25 | | |
22 | 26 | | |
23 | 27 | | |
| |||
56 | 60 | | |
57 | 61 | | |
58 | 62 | | |
59 | | - | |
60 | 63 | | |
61 | 64 | | |
62 | 65 | | |
| |||
112 | 115 | | |
113 | 116 | | |
114 | 117 | | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
115 | 125 | | |
116 | 126 | | |
117 | 127 | | |
118 | 128 | | |
119 | | - | |
| 129 | + | |
120 | 130 | | |
121 | 131 | | |
122 | | - | |
| 132 | + | |
123 | 133 | | |
124 | 134 | | |
125 | 135 | | |
| |||
130 | 140 | | |
131 | 141 | | |
132 | 142 | | |
133 | | - | |
| 143 | + | |
134 | 144 | | |
135 | 145 | | |
136 | 146 | | |
| |||
180 | 190 | | |
181 | 191 | | |
182 | 192 | | |
183 | | - | |
184 | | - | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
185 | 196 | | |
186 | 197 | | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
187 | 204 | | |
188 | 205 | | |
189 | 206 | | |
| |||
226 | 243 | | |
227 | 244 | | |
228 | 245 | | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
229 | 250 | | |
230 | | - | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
231 | 255 | | |
232 | 256 | | |
233 | 257 | | |
| |||
263 | 287 | | |
264 | 288 | | |
265 | 289 | | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
266 | 297 | | |
267 | 298 | | |
268 | | - | |
| 299 | + | |
| 300 | + | |
269 | 301 | | |
270 | 302 | | |
271 | 303 | | |
| |||
374 | 406 | | |
375 | 407 | | |
376 | 408 | | |
| 409 | + | |
| 410 | + | |
377 | 411 | | |
378 | | - | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
379 | 419 | | |
380 | 420 | | |
381 | 421 | | |
| |||
0 commit comments