RFR: 8367704: Fix minor documentation issues in java.time.** [v6]

Pavel Rappo prappo at openjdk.org
Sat Sep 20 13:09:19 UTC 2025


On Sat, 20 Sep 2025 08:06:22 GMT, Stephen Colebourne <scolebourne at openjdk.org> wrote:

> `Period.isNegative()` would be used in validation, to ensure that the period you are receiving only has components that are >= 0. One can certainly argue about the method name, but c'est la vie...

I understand that it could be used for some sort of validation. But what is the usual action when `period.isNegative() == true`?

If the period is non-negative, then the semantic is clear. However, if it is negative, then it's hard to understand what that means. For example, `Period.of(/* years */ 0, /* months */ 1, /* days */ -32)` is net-negative, but `Period.of(/* years */ 0, /* months */ 1, /* days */ -1)` is net-positive. It also probably depends on the chronology in use.

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

PR Comment: https://git.openjdk.org/jdk/pull/27296#issuecomment-3314959449


More information about the core-libs-dev mailing list