Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8084571 | emb-9 | Daniel Fuchs | P4 | Resolved | Fixed | team |
The java.time.Clock::systemUTC() method currently creates an instance every time it is called. It should return a private constant instead, as the returned instance is immutable and could be shared.
The spec does not constrain this method - "The returned implementation is immutable, thread-safe and {@code Serializable}. It is equivalent to {@code system(ZoneOffset.UTC)}." - which would still be satisfied by returning a constant instead of a new instance.
The spec does not constrain this method - "The returned implementation is immutable, thread-safe and {@code Serializable}. It is equivalent to {@code system(ZoneOffset.UTC)}." - which would still be satisfied by returning a constant instead of a new instance.
- backported by
-
JDK-8084571 Clock.systemUTC() should return a constant
-
- Resolved
-
- relates to
-
JDK-8074023 Clock.system(ZoneId) could be optimized to always return the same clock for a given zone.
-
- Open
-