error-prone icon indicating copy to clipboard operation
error-prone copied to clipboard

Open source GoodTime checks

Open ash211 opened this issue 6 months ago • 0 comments

Context

Google projects like Guava have @SuppressWarnings("GoodTime") in various places (github search, sourcegraph search).

As I understand it from my time at Google, the GoodTime checks make working with time better in Java, and help devs avoid footguns. Things like:

  • prefer using java.time over older libraries like Joda
  • prefer using strongly typed Instant and Duration over weakly typed int millis or int epochSeconds
  • use TimeSource instead of Instant.now() to allow testing with an externally-supplied fake clock/source
  • many others I'm sure

Issue

Are these GoodTime checks something that might be open sourced? I remember them fondly and wish they were running on my current codebases!

ash211 avatar Jun 04 '25 21:06 ash211