RFR: 8310033: Clarify return value of Java Time compareTo methods [v2]

Jens Lidestrom duke at openjdk.org
Sun Jun 18 19:36:25 UTC 2023


On Fri, 16 Jun 2023 22:12:43 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> In java.time packages, clarify timeline order javadoc to mention "before" and "after" in the value of the `compareTo` method return values. 
>> Add javadoc @see tags to isBefore and isAfter methods
>> 
>> Replace use of "negative" and positive with "less than zero" and "greater than zero" in javadoc @return
>> The term "positive" is ambiguous, zero is considered positive and indicates equality.
>
> Roger Riggs has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:
> 
>  - Use {@code xxx} to highlight the comparison against the arg.
>    Update copyrights.
>  - Merge branch 'master' into 8310033-time-compareto
>  - Clarify for Duration, AbstractChronology, and Chronology
>  - Correct javadoc of compareInstant
>  - 8310033: Improve Instant.compareTo javadoc to mention before and after
>    Refine timeline order to mention before and after
>    Add javadoc @see tags to isBefore and isAfter methods

>  The term "positive" is ambiguous, zero is considered positive and indicates equality.

Where did you get this idea? A "positive" means a number that is _greater_ than zero.

See both these dictionaries:

https://dictionary.cambridge.org/dictionary/english/positive
https://www.merriam-webster.com/dictionary/positive

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

PR Comment: https://git.openjdk.org/jdk/pull/14479#issuecomment-1596244674


More information about the core-libs-dev mailing list