Summary
Write "duration" instead of "period" in a few places in the java.time.Duration javadoc.
Problem
Copy-paste error in java.time.Duration. The "period" wording belongs in java.time.Period.
Solution
Write "duration" instead of "period".
Specification
See https://github.com/openjdk/jdk/pull/16573. Inline patch:
diff --git a/src/java.base/share/classes/java/time/Duration.java b/src/java.base/share/classes/java/time/Duration.java
index ab46159efd6a..402ecba77287 100644
--- a/src/java.base/share/classes/java/time/Duration.java
+++ b/src/java.base/share/classes/java/time/Duration.java
@@ -305,7 +305,7 @@ public static Duration ofNanos(long nanos) {
* @param amount the amount of the duration, measured in terms of the unit, positive or negative
* @param unit the unit that the duration is measured in, must have an exact duration, not null
* @return a {@code Duration}, not null
- * @throws DateTimeException if the period unit has an estimated duration
+ * @throws DateTimeException if the unit has an estimated duration
* @throws ArithmeticException if a numeric overflow occurs
*/
public static Duration of(long amount, TemporalUnit unit) {
@@ -352,7 +352,7 @@ public static Duration from(TemporalAmount amount) {
* considered to be exactly 24 hours.
* <p>
* The string starts with an optional sign, denoted by the ASCII negative
- * or positive symbol. If negative, the whole period is negated.
+ * or positive symbol. If negative, the whole duration is negated.
* The ASCII letter "P" is next in upper or lower case.
* There are then four sections, each consisting of a number and a suffix.
* The sections have suffixes in ASCII of "D", "H", "M" and "S" for
@@ -476,7 +476,7 @@ private static Duration create(boolean negate, long daysAsSecs, long hoursAsSecs
* For full accuracy, either the {@link ChronoUnit#NANOS NANOS} unit or the
* {@link ChronoField#NANO_OF_SECOND NANO_OF_SECOND} field should be supported.
* <p>
- * The result of this method can be a negative period if the end is before the start.
+ * The result of this method can be a negative duration if the end is before the start.
* To guarantee to obtain a positive duration call {@link #abs()} on the result.
*
* @param startInclusive the start instant, inclusive, not null
@@ -671,7 +671,7 @@ public int getNano() {
* This instance is immutable and unaffected by this method call.
*
* @param seconds the seconds to represent, may be negative
- * @return a {@code Duration} based on this period with the requested seconds, not null
+ * @return a {@code Duration} based on this duration with the requested seconds, not null
*/
public Duration withSeconds(long seconds) {
return create(seconds, nanos);
@@ -686,7 +686,7 @@ public Duration withSeconds(long seconds) {
* This instance is immutable and unaffected by this method call.
*
* @param nanoOfSecond the nano-of-second to represent, from 0 to 999,999,999
- * @return a {@code Duration} based on this period with the requested nano-of-second, not null
+ * @return a {@code Duration} based on this duration with the requested nano-of-second, not null
* @throws DateTimeException if the nano-of-second is invalid
*/
public Duration withNanos(int nanoOfSecond) {
- csr of
-
JDK-8319753 Duration javadoc has "period" instead of "duration" in several places
-
- Resolved
-