On Thu, 22 Jun 2023 19:03:03 GMT, Roger Riggs <rri...@openjdk.org> wrote:

> Remove a redundant comparison in java.time `OffsetDateTime.compareTo()`. 
> If the `compareInstant` utility method returns 0 (equal), it compares the 
> `LocalDateTime`.
> However, `compareInstant` has already done that comparison; if it found 
> equal, the `compareTo` method unnecessarily does it again.
> The code is refactored in `compareTo` to do the comparison of `LocalDateTime` 
> exactly once, if it is needed.
> 
> This case is NOT covered by an existing test in 
> test/jdk/java/time/tck/java/time/TCKOffsetDateTime.java

This pull request has now been integrated.

Changeset: 11fd34e1
Author:    Roger Riggs <rri...@openjdk.org>
URL:       
https://git.openjdk.org/jdk/commit/11fd34e196b29d2f2fd276c36f59a3c3b3ce7280
Stats:     9 lines in 2 files changed: 7 ins; 0 del; 2 mod

8310241: OffsetDateTime compareTo redundant computation

Reviewed-by: naoto

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

PR: https://git.openjdk.org/jdk/pull/14618

Reply via email to