Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8073394

Clock.systemUTC() should return a constant

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 8
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b53

      Backports

        Description

        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.

          Issue Links

            Activity

            No work has yet been logged on this issue.

              People

              • Assignee:
                dfuchs Daniel Fuchs
                Reporter:
                scolebourne Stephen Colebourne
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: