RFR: 8266846: Add java.time.InstantSource

Anthony Vanelverdinghe github.com+15714253+anthonyvdotbe at openjdk.java.net
Sat May 15 08:27:07 UTC 2021


On Thu, 13 May 2021 20:52:33 GMT, Stephen Colebourne <scolebourne at openjdk.org> wrote:

> 8266846: Add java.time.InstantSource

A nice addition to the JDK, thanks for taking this on.

src/java.base/share/classes/java/time/Clock.java line 114:

> 112:  * provides access to the current instant, and does not provide access to the time-zone.
> 113:  * Where an application only requires the current instant {@code InstantSource} should
> 114:  * be preferred to this class. For example, his might be the case where the time-zone

his -> this

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.

src/java.base/share/classes/java/time/InstantSource.java line 59:

> 57:  *  }
> 58:  * </pre>
> 59:  * This approach allows an alternate source, such as {@link #fixed(Instant) fixed}

alternate -> alternative? To me (being a non-native speaker) the latter reads more naturally

src/java.base/share/classes/java/time/InstantSource.java line 62:

> 60:  * or {@link #offset(InstantSource, Duration) offset} to be used during testing.
> 61:  * <p>
> 62:  * The {@code system} factory method provide a source based on the best available

provide -> provides

src/java.base/share/classes/java/time/InstantSource.java line 63:

> 61:  * <p>
> 62:  * The {@code system} factory method provide a source based on the best available
> 63:  * system clock This may use {@link System#currentTimeMillis()}, or a higher

missing dot after "clock"

src/java.base/share/classes/java/time/InstantSource.java line 175:

> 173:     /**
> 174:      * Obtains a source that returns instants from the specified source with the
> 175:      * specified duration added

missing dot to end the sentence

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

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


More information about the core-libs-dev mailing list