JDK-8326124 : Typo in java doc of DayOfWeek#minus
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.time
  • Affected Version: 8,11,17,21,22
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2024-02-18
  • Updated: 2024-02-19
  • Resolved: 2024-02-19
Related Reports
Duplicate :  
Description
A DESCRIPTION OF THE PROBLEM :
In DayOfWeek#plus
>The calculation rolls around the end of the *week* from Sunday to Monday. The specified period may be negative.
But in DayOfWeek#minus
>The calculation rolls around the start of the *year* from Monday to Sunday. The specified period may be negative.
year is should be a typo here
https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/time/DayOfWeek.html#minus(long)
This happens since Java 8

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Update the method document to
"The calculation rolls around the start of the week from Monday to Sunday. The specified period may be negative."

FREQUENCY : always



Comments
The following documents have the same issue: https://docs.oracle.com/javase/8/docs/api/java/time/DayOfWeek.html#minus-long- https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/time/DayOfWeek.html#minus(long) https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/time/DayOfWeek.html#minus(long) https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/time/DayOfWeek.html#minus(long) https://download.java.net/java/early_access/jdk22/docs/api/java.base/java/time/DayOfWeek.html#minus(long)
19-02-2024