RFR: 8368856: Add a method to safely add duration to instant [v2]

Pavel Rappo prappo at openjdk.org
Tue Sep 30 17:38:58 UTC 2025


On Tue, 30 Sep 2025 16:55:18 GMT, Naoto Sato <naoto at openjdk.org> wrote:

> If we were to add a new method, should we add an equivalent new method for `minus` for consistency?

We could. I'm not against it. I just wonder if it's going to be useful. A typical deadline is calculated as `now + delay`, where `delay >= 0`.

On the other hand, that issue with `i.minus(Duration.between(Instant.MAX, i)`, which I [described][] here yesterday, makes me think that `minus` might be useful if only for that.

[described]: https://github.com/openjdk/jdk/pull/27549#issuecomment-3347925868

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

PR Comment: https://git.openjdk.org/jdk/pull/27549#issuecomment-3353189095


More information about the core-libs-dev mailing list