Records for Annotation Values

Nathan Reynolds numeralnathan at gmail.com
Sat Jul 2 16:41:15 UTC 2022


If I understand correctly, records are immutable.  Annotation values
require immutable values.  Can we allow records for annotation values?
What would be the problems with this?

For example, I would love for Duration to be made into a record and then
Duration can be put into an annotation.

@Retry(maxAttempts = 3, delay = Duration.ofSeconds(10))

... as opposed to what is required today ...

@Retry(maxAttempts = 3, delay = 10, durationUnit = ChronoUnit.SECONDS)  //
This is error prone because the value and units are separated and the
reader may make a mistake

If Duration, Instant, etc. hasn't been made into a record, I realize that
this might need to wait so that the classes evolve slowly.  Let's ignore
that possible constraint for this discussion.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20220702/71914ebd/attachment.htm>


More information about the amber-dev mailing list