Details
-
Bug
-
Resolution: Fixed
-
P1
-
8
-
b124
-
linux_ubuntu
-
Verified
Backports
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8031329 | 9 | Roger Riggs | P1 | Closed | Fixed | b01 |
JDK-8032137 | 8u20 | Roger Riggs | P1 | Closed | Fixed | b01 |
JDK-8032418 | 8u5 | Roger Riggs | P1 | Resolved | Fixed | b05 |
Description
A DESCRIPTION OF THE PROBLEM :
The toDays() and toHours() methods in java.time.Duration have wrong Javadoc comments. They seem to be exact copies of the toMinutes() Javadoc, with only the number of seconds adjusted, but not the wording.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
/**
* Gets the number of days in this duration.
* <p>
* This returns the total number of days in the duration by dividing the
* number of seconds by 86400.
* This is based on the standard definition of a day as 24 hours.
* <p>
* This instance is immutable and unaffected by this method call.
*
* @return the number of days in the duration, may be negative
*/
public long toDays() {
return seconds / SECONDS_PER_DAY;
}
/**
* Gets the number of hours in this duration.
* <p>
* This returns the total number of hours in the duration by dividing the
* number of seconds by 3600.
* <p>
* This instance is immutable and unaffected by this method call.
*
* @return the number of hours in the duration, may be negative
*/
public long toHours() {
return seconds / SECONDS_PER_HOUR;
}
/**
* Gets the number of minutes in this duration.
* <p>
* This returns the total number of minutes in the duration by dividing the
* number of seconds by 60.
* <p>
* This instance is immutable and unaffected by this method call.
*
* @return the number of minutes in the duration, may be negative
*/
public long toMinutes() {
return seconds / SECONDS_PER_MINUTE;
}
ACTUAL -
/**
* Gets the number of minutes in this duration.
* <p>
* This returns the total number of minutes in the duration by dividing the
* number of seconds by 86400.
* This is based on the standard definition of a day as 24 hours.
* <p>
* This instance is immutable and unaffected by this method call.
*
* @return the number of minutes in the duration, may be negative
*/
public long toDays() {
return seconds / SECONDS_PER_DAY;
}
/**
* Gets the number of minutes in this duration.
* <p>
* This returns the total number of minutes in the duration by dividing the
* number of seconds by 3600.
* <p>
* This instance is immutable and unaffected by this method call.
*
* @return the number of minutes in the duration, may be negative
*/
public long toHours() {
return seconds / SECONDS_PER_HOUR;
}
/**
* Gets the number of minutes in this duration.
* <p>
* This returns the total number of minutes in the duration by dividing the
* number of seconds by 60.
* <p>
* This instance is immutable and unaffected by this method call.
*
* @return the number of minutes in the duration, may be negative
*/
public long toMinutes() {
return seconds / SECONDS_PER_MINUTE;
}
URL OF FAULTY DOCUMENTATION :
http://download.java.net/jdk8/docs/api/java/time/Duration.html
The toDays() and toHours() methods in java.time.Duration have wrong Javadoc comments. They seem to be exact copies of the toMinutes() Javadoc, with only the number of seconds adjusted, but not the wording.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
/**
* Gets the number of days in this duration.
* <p>
* This returns the total number of days in the duration by dividing the
* number of seconds by 86400.
* This is based on the standard definition of a day as 24 hours.
* <p>
* This instance is immutable and unaffected by this method call.
*
* @return the number of days in the duration, may be negative
*/
public long toDays() {
return seconds / SECONDS_PER_DAY;
}
/**
* Gets the number of hours in this duration.
* <p>
* This returns the total number of hours in the duration by dividing the
* number of seconds by 3600.
* <p>
* This instance is immutable and unaffected by this method call.
*
* @return the number of hours in the duration, may be negative
*/
public long toHours() {
return seconds / SECONDS_PER_HOUR;
}
/**
* Gets the number of minutes in this duration.
* <p>
* This returns the total number of minutes in the duration by dividing the
* number of seconds by 60.
* <p>
* This instance is immutable and unaffected by this method call.
*
* @return the number of minutes in the duration, may be negative
*/
public long toMinutes() {
return seconds / SECONDS_PER_MINUTE;
}
ACTUAL -
/**
* Gets the number of minutes in this duration.
* <p>
* This returns the total number of minutes in the duration by dividing the
* number of seconds by 86400.
* This is based on the standard definition of a day as 24 hours.
* <p>
* This instance is immutable and unaffected by this method call.
*
* @return the number of minutes in the duration, may be negative
*/
public long toDays() {
return seconds / SECONDS_PER_DAY;
}
/**
* Gets the number of minutes in this duration.
* <p>
* This returns the total number of minutes in the duration by dividing the
* number of seconds by 3600.
* <p>
* This instance is immutable and unaffected by this method call.
*
* @return the number of minutes in the duration, may be negative
*/
public long toHours() {
return seconds / SECONDS_PER_HOUR;
}
/**
* Gets the number of minutes in this duration.
* <p>
* This returns the total number of minutes in the duration by dividing the
* number of seconds by 60.
* <p>
* This instance is immutable and unaffected by this method call.
*
* @return the number of minutes in the duration, may be negative
*/
public long toMinutes() {
return seconds / SECONDS_PER_MINUTE;
}
URL OF FAULTY DOCUMENTATION :
http://download.java.net/jdk8/docs/api/java/time/Duration.html
Attachments
Issue Links
- backported by
-
JDK-8032418 java.time.Duration has wrong Javadoc Comments in toDays() and toHours()
- Resolved
-
JDK-8031329 java.time.Duration has wrong Javadoc Comments in toDays() and toHours()
- Closed
-
JDK-8032137 java.time.Duration has wrong Javadoc Comments in toDays() and toHours()
- Closed