robolectric / robolectric

Android Unit Testing Framework
http://robolectric.org
Other
5.82k stars 1.36k forks source link

org.robolectric.util.Scheduler should use java.time APIs #8976

Open kluever opened 2 months ago

kluever commented 2 months ago

Instead of using an ambiguous (w.r.t. the unit) long to represent date/time concepts (like a delay or "now"), please use the appropriate java.time types (Duration or Instant).

There's a bunch of APIs in org.robolectric.util.Scheduler that could be improved using java.time types.

brettchabot commented 2 months ago

IMO Scheduler API should have been deprecated at the same time as LooperMode.LEGACY. I'll send out a PR to correct this.

hoisie commented 2 months ago

@kluever thanks for the post. These APIs are probably suboptimal. However, they are related to the legacy looper mode, which has been deprecated for 5+ years. There is not much point in investing a significant amount of resources to migrate something that is deprecated and obsolete to a more modern API.