RFR: 8374808: Add an Instance in place of Date for KeyStore and KeyStoreSpi [v2]
Weijun Wang
weijun at openjdk.org
Wed Jan 14 21:16:30 UTC 2026
On Wed, 14 Jan 2026 17:19:36 GMT, Mikhail Yankelevich <myankelevich at openjdk.org> wrote:
>> Hi!
>>
>> This is my proposal to transfer `KeyStore` and `KeyStoreSpi` with internal implementations to use `Instance`s instead of `Date`s.
>> I would be very grateful for your comments and suggestions.
>>
>> Thanks!
>>
>> P.S. this is related to [JDK-8350953](https://bugs.openjdk.org/browse/JDK-8350953)
>
> Mikhail Yankelevich has updated the pull request incrementally with one additional commit since the last revision:
>
> DKS tests enhanced
Some comments.
I have a small concern on the `Instant.now()` calls everywhere. As you can see in your `TestKeyStoreBasic.java` test, the value is truncated when persisting inside a keystore and when loaded again it's not identical to the old value. Will this create any interop issue in the real world? If we know a keystore implementation only support the precision of milliseconds, should we truncate it early?
src/java.base/share/classes/java/security/KeyStore.java line 1187:
> 1185: * Returns the creation date of the entry identified by the given alias.
> 1186: * <p>
> 1187: * This method returns a Date, which is mutable and more error-prone.
Put `Date` in `{@code}`.
-------------
PR Review: https://git.openjdk.org/jdk/pull/29140#pullrequestreview-3662667039
PR Review Comment: https://git.openjdk.org/jdk/pull/29140#discussion_r2691998489
More information about the security-dev
mailing list