RFR: 8266846: Add java.time.InstantSource

Stephen Colebourne scolebourne at openjdk.java.net
Sat May 15 08:27:09 UTC 2021


On Fri, 14 May 2021 07:19:03 GMT, Anthony Vanelverdinghe <github.com+15714253+anthonyvdotbe at openjdk.org> wrote:

>> 8266846: Add java.time.InstantSource
>
> src/java.base/share/classes/java/time/Clock.java line 513:
> 
>> 511:      * {@link System#currentTimeMillis()} or equivalent.
>> 512:      */
>> 513:     static final class SystemInstantSource implements InstantSource, Serializable {
> 
> Is it possible to declare this as an enum? As doing so would simplify its implementation.

My feeling is that in this case it is better to keep control of the kind of class being used.

-------------

PR: https://git.openjdk.java.net/jdk/pull/4016


More information about the core-libs-dev mailing list