RFR: 8266846: Add java.time.InstantSource [v2]

Roger Riggs rriggs at openjdk.java.net
Mon May 17 17:45:42 UTC 2021


On Mon, 17 May 2021 17:13:58 GMT, Stephen Colebourne <scolebourne at openjdk.org> wrote:

>> src/java.base/share/classes/java/time/Clock.java line 128:
>> 
>>> 126:  * Implementations should implement {@code Serializable} wherever possible and must
>>> 127:  * document whether or not they do support serialization.
>>> 128:  *
>> 
>> The ImplSpec needs to say how it is implemented.
>> The 'implements InstantSource' can not mandate any particular implementation. Its just an interface the real behavior comes from its implementations.  In this case Clock.  Referring to the static methods of InstantSource behavior may be sufficient because that behavior is concrete.
>
> There are plenty of examples of interfaces in `java.time` and elsewhere that apply restrictions to implementations. Nevertheless, for simplicity and expediency I have reinstated the `implSpec` on `Clock`

ok, thanks.
Assertions in interfaces are toothless. Tests can only be written for implementations.

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

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


More information about the core-libs-dev mailing list