google / google/error-prone

Usage of Clock.systemDefaultZone() should not trigger [JavaTimeDefaultTimeZone]

Open
#1,312 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
7.2k
Forks
820
Avg merge
5h 9m
Merged PRs (30d)
50

Description

### Description of the problem / feature request:
Using the static method `java.time.Clock.systemDefaultZone()` triggers the warning
> [JavaTimeDefaultTimeZone] Clock.systemDefaultZone() is not allowed because it silently uses the system default time-zone. (..)

I think it's a bit funny that calling a method named "systemDefaultZone()" causes a warning containing the phrase "**it silently** uses the system default time-zone".

I could probably workaround the warning by using `Clock.system(ZoneId.systemDefault())`, but I would argue that I shouldn't have to do this. I think `Clock.systemDefaultZone()` is just as descriptive as the workaround, if not even more so.

### What version of Error Prone are you using?
2.3.3

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.