Current thinking about the future nullability of java.time.Duration

Jean-Noël Rouvignac jean-noel.rouvignac at pingidentity.com
Sun Dec 29 16:48:47 UTC 2024


Hello,

I have a use case for configuration objects where I would like to
use java.time.Duration to represent time intervals, timeouts, delays, etc.
for example.

In these configuration objects, sometimes users may not provide a value,
and the configuration framework does not have a default value for it
either. This is to be interpreted as "disable the feature" or "let the
library decide". For this specific case, I was considering returning `null`
to mean "disable the feature" or "let the library decide".

java.time.Duration being marked as a value based class, I wanted to confirm
that using `null` will not force significant rework in the future? i.e.
java.time.Duration will not opt-in to become a null-restricted value class
type (https://openjdk.org/jeps/8316779).

Thanks a lot, and thanks for the huge work on Valhalla. Good luck for
bringing it into mainline Java !

Jean-Noël

-- 
_CONFIDENTIALITY NOTICE: This email may contain confidential and privileged 
material for the sole use of the intended recipient(s). Any review, use, 
distribution or disclosure by others is strictly prohibited.  If you have 
received this communication in error, please notify the sender immediately 
by e-mail and delete the message and any file attachments from your 
computer. Thank you._
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/valhalla-dev/attachments/20241229/5a58b8d7/attachment.htm>


More information about the valhalla-dev mailing list