Skip to content

Commit e44ef0c

Browse files
committed
8367704: Fix minor documentation issues in java.time.**
Reviewed-by: naoto, rriggs
1 parent c54dcef commit e44ef0c

File tree

8 files changed

+36
-36
lines changed

8 files changed

+36
-36
lines changed

src/java.base/share/classes/java/time/Duration.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ private static class Lazy {
172172
* Obtains a {@code Duration} representing a number of standard 24 hour days.
173173
* <p>
174174
* The seconds are calculated based on the standard definition of a day,
175-
* where each day is 86400 seconds which implies a 24 hour day.
175+
* where each day is 86,400 seconds which implies a 24 hour day.
176176
* The nanosecond in second field is set to zero.
177177
*
178178
* @param days the number of days, positive or negative
@@ -187,7 +187,7 @@ public static Duration ofDays(long days) {
187187
* Obtains a {@code Duration} representing a number of standard hours.
188188
* <p>
189189
* The seconds are calculated based on the standard definition of an hour,
190-
* where each hour is 3600 seconds.
190+
* where each hour is 3,600 seconds.
191191
* The nanosecond in second field is set to zero.
192192
*
193193
* @param hours the number of hours, positive or negative
@@ -375,8 +375,8 @@ public static Duration from(TemporalAmount amount) {
375375
* <pre>
376376
* "PT20.345S" -- parses as "20.345 seconds"
377377
* "PT15M" -- parses as "15 minutes" (where a minute is 60 seconds)
378-
* "PT10H" -- parses as "10 hours" (where an hour is 3600 seconds)
379-
* "P2D" -- parses as "2 days" (where a day is 24 hours or 86400 seconds)
378+
* "PT10H" -- parses as "10 hours" (where an hour is 3,600 seconds)
379+
* "P2D" -- parses as "2 days" (where a day is 24 hours or 86,400 seconds)
380380
* "P2DT3H4M" -- parses as "2 days, 3 hours and 4 minutes"
381381
* "PT-6H3M" -- parses as "-6 hours and +3 minutes"
382382
* "-PT6H3M" -- parses as "-6 hours and -3 minutes"
@@ -477,7 +477,7 @@ private static Duration create(boolean negate, long daysAsSecs, long hoursAsSecs
477477
* {@link ChronoField#NANO_OF_SECOND NANO_OF_SECOND} field should be supported.
478478
* <p>
479479
* The result of this method can be a negative duration if the end is before the start.
480-
* To guarantee to obtain a positive duration call {@link #abs()} on the result.
480+
* To guarantee a positive duration, call {@link #abs()} on the result.
481481
*
482482
* @param startInclusive the start instant, inclusive, not null
483483
* @param endExclusive the end instant, exclusive, not null
@@ -752,7 +752,7 @@ public Duration plus(long amountToAdd, TemporalUnit unit) {
752752
/**
753753
* Returns a copy of this duration with the specified duration in standard 24 hour days added.
754754
* <p>
755-
* The number of days is multiplied by 86400 to obtain the number of seconds to add.
755+
* The number of days is multiplied by 86,400 to obtain the number of seconds to add.
756756
* This is based on the standard definition of a day as 24 hours.
757757
* <p>
758758
* This instance is immutable and unaffected by this method call.
@@ -893,7 +893,7 @@ public Duration minus(long amountToSubtract, TemporalUnit unit) {
893893
/**
894894
* Returns a copy of this duration with the specified duration in standard 24 hour days subtracted.
895895
* <p>
896-
* The number of days is multiplied by 86400 to obtain the number of seconds to subtract.
896+
* The number of days is multiplied by 86,400 to obtain the number of seconds to subtract.
897897
* This is based on the standard definition of a day as 24 hours.
898898
* <p>
899899
* This instance is immutable and unaffected by this method call.
@@ -909,7 +909,7 @@ public Duration minusDays(long daysToSubtract) {
909909
/**
910910
* Returns a copy of this duration with the specified duration in hours subtracted.
911911
* <p>
912-
* The number of hours is multiplied by 3600 to obtain the number of seconds to subtract.
912+
* The number of hours is multiplied by 3,600 to obtain the number of seconds to subtract.
913913
* <p>
914914
* This instance is immutable and unaffected by this method call.
915915
*
@@ -924,7 +924,7 @@ public Duration minusHours(long hoursToSubtract) {
924924
/**
925925
* Returns a copy of this duration with the specified duration in minutes subtracted.
926926
* <p>
927-
* The number of hours is multiplied by 60 to obtain the number of seconds to subtract.
927+
* The number of minutes is multiplied by 60 to obtain the number of seconds to subtract.
928928
* <p>
929929
* This instance is immutable and unaffected by this method call.
930930
*
@@ -1165,7 +1165,7 @@ public Temporal subtractFrom(Temporal temporal) {
11651165
* Gets the number of days in this duration.
11661166
* <p>
11671167
* This returns the total number of days in the duration by dividing the
1168-
* number of seconds by 86400.
1168+
* number of seconds by 86,400.
11691169
* This is based on the standard definition of a day as 24 hours.
11701170
* <p>
11711171
* This instance is immutable and unaffected by this method call.
@@ -1180,7 +1180,7 @@ public long toDays() {
11801180
* Gets the number of hours in this duration.
11811181
* <p>
11821182
* This returns the total number of hours in the duration by dividing the
1183-
* number of seconds by 3600.
1183+
* number of seconds by 3,600.
11841184
* <p>
11851185
* This instance is immutable and unaffected by this method call.
11861186
*
@@ -1272,7 +1272,7 @@ public long toNanos() {
12721272
* Extracts the number of days in the duration.
12731273
* <p>
12741274
* This returns the total number of days in the duration by dividing the
1275-
* number of seconds by 86400.
1275+
* number of seconds by 86,400.
12761276
* This is based on the standard definition of a day as 24 hours.
12771277
* <p>
12781278
* This instance is immutable and unaffected by this method call.
@@ -1476,10 +1476,10 @@ public int hashCode() {
14761476
* <p>
14771477
* Examples:
14781478
* <pre>
1479-
* "20.345 seconds" -- "PT20.345S
1479+
* "20.345 seconds" -- "PT20.345S"
14801480
* "15 minutes" (15 * 60 seconds) -- "PT15M"
1481-
* "10 hours" (10 * 3600 seconds) -- "PT10H"
1482-
* "2 days" (2 * 86400 seconds) -- "PT48H"
1481+
* "10 hours" (10 * 3,600 seconds) -- "PT10H"
1482+
* "2 days" (2 * 86,400 seconds) -- "PT48H"
14831483
* </pre>
14841484
* Note that multiples of 24 hours are not output as days to avoid confusion
14851485
* with {@code Period}.

src/java.base/share/classes/java/time/Instant.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,15 @@
114114
* <p>
115115
* The length of the solar day is the standard way that humans measure time.
116116
* This has traditionally been subdivided into 24 hours of 60 minutes of 60 seconds,
117-
* forming a 86400 second day.
117+
* forming an 86,400 second day.
118118
* <p>
119119
* Modern timekeeping is based on atomic clocks which precisely define an SI second
120120
* relative to the transitions of a Caesium atom. The length of an SI second was defined
121-
* to be very close to the 86400th fraction of a day.
121+
* to be very close to the 86,400th fraction of a day.
122122
* <p>
123123
* Unfortunately, as the Earth rotates the length of the day varies.
124124
* In addition, over time the average length of the day is getting longer as the Earth slows.
125-
* As a result, the length of a solar day in 2012 is slightly longer than 86400 SI seconds.
125+
* As a result, the length of a solar day in 2012 is slightly longer than 86,400 SI seconds.
126126
* The actual length of any given day and the amount by which the Earth is slowing
127127
* are not predictable and can only be determined by measurement.
128128
* The UT1 time-scale captures the accurate length of day, but is only available some
@@ -131,7 +131,7 @@
131131
* The UTC time-scale is a standard approach to bundle up all the additional fractions
132132
* of a second from UT1 into whole seconds, known as <i>leap-seconds</i>.
133133
* A leap-second may be added or removed depending on the Earth's rotational changes.
134-
* As such, UTC permits a day to have 86399 SI seconds or 86401 SI seconds where
134+
* As such, UTC permits a day to have 86,399 SI seconds or 86,401 SI seconds where
135135
* necessary in order to keep the day aligned with the Sun.
136136
* <p>
137137
* The modern UTC time-scale was introduced in 1972, introducing the concept of whole leap-seconds.
@@ -143,7 +143,7 @@
143143
* Given the complexity of accurate timekeeping described above, this Java API defines
144144
* its own time-scale, the <i>Java Time-Scale</i>.
145145
* <p>
146-
* The Java Time-Scale divides each calendar day into exactly 86400
146+
* The Java Time-Scale divides each calendar day into exactly 86,400
147147
* subdivisions, known as seconds. These seconds may differ from the
148148
* SI second. It closely matches the de facto international civil time
149149
* scale, the definition of which changes from time to time.
@@ -171,7 +171,7 @@
171171
* This is identical to UTC on days that do not have a leap second.
172172
* On days that do have a leap second, the leap second is spread equally
173173
* over the last 1000 seconds of the day, maintaining the appearance of
174-
* exactly 86400 seconds per day.
174+
* exactly 86,400 seconds per day.
175175
* <p>
176176
* For the segment prior to 1972-11-03, extending back arbitrarily far,
177177
* the consensus international time scale is defined to be UT1, applied

src/java.base/share/classes/java/time/Period.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ public Period minusMonths(long monthsToSubtract) {
765765
* <p>
766766
* This instance is immutable and unaffected by this method call.
767767
*
768-
* @param daysToSubtract the months to subtract, positive or negative
768+
* @param daysToSubtract the days to subtract, positive or negative
769769
* @return a {@code Period} based on this period with the specified days subtracted, not null
770770
* @throws ArithmeticException if numeric overflow occurs
771771
*/

src/java.base/share/classes/java/time/ZoneOffset.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -417,9 +417,9 @@ private static int totalSeconds(int hours, int minutes, int seconds) {
417417
/**
418418
* Obtains an instance of {@code ZoneOffset} specifying the total offset in seconds
419419
* <p>
420-
* The offset must be in the range {@code -18:00} to {@code +18:00}, which corresponds to -64800 to +64800.
420+
* The offset must be in the range {@code -18:00} to {@code +18:00}, which corresponds to -64,800 to +64,800.
421421
*
422-
* @param totalSeconds the total time-zone offset in seconds, from -64800 to +64800
422+
* @param totalSeconds the total time-zone offset in seconds, from -64,800 to +64,800
423423
* @return the ZoneOffset, not null
424424
* @throws DateTimeException if the offset is not in the required range
425425
*/
@@ -450,7 +450,7 @@ public static ZoneOffset ofTotalSeconds(int totalSeconds) {
450450
/**
451451
* Constructor.
452452
*
453-
* @param totalSeconds the total time-zone offset in seconds, from -64800 to +64800
453+
* @param totalSeconds the total time-zone offset in seconds, from -64,800 to +64,800
454454
*/
455455
private ZoneOffset(int totalSeconds) {
456456
this.totalSeconds = totalSeconds;

src/java.base/share/classes/java/time/ZonedDateTime.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
* For Overlaps, the general strategy is that if the local date-time falls in the
137137
* middle of an Overlap, then the previous offset will be retained. If there is no
138138
* previous offset, or the previous offset is invalid, then the earlier offset is
139-
* used, typically "summer" time.. Two additional methods,
139+
* used, typically "summer" time. Two additional methods,
140140
* {@link #withEarlierOffsetAtOverlap()} and {@link #withLaterOffsetAtOverlap()},
141141
* help manage the case of an overlap.
142142
* <p>
@@ -246,7 +246,7 @@ public static ZonedDateTime now(Clock clock) {
246246
* Time-zone rules, such as daylight savings, mean that not every local date-time
247247
* is valid for the specified zone, thus the local date-time may be adjusted.
248248
* <p>
249-
* The local date time and first combined to form a local date-time.
249+
* The local date and time are first combined to form a local date-time.
250250
* The local date-time is then resolved to a single instant on the time-line.
251251
* This is achieved by finding a valid offset from UTC/Greenwich for the local
252252
* date-time as defined by the {@link ZoneRules rules} of the zone ID.
@@ -263,7 +263,7 @@ public static ZonedDateTime now(Clock clock) {
263263
* @param date the local date, not null
264264
* @param time the local time, not null
265265
* @param zone the time-zone, not null
266-
* @return the offset date-time, not null
266+
* @return the zoned date-time, not null
267267
*/
268268
public static ZonedDateTime of(LocalDate date, LocalTime time, ZoneId zone) {
269269
return of(LocalDateTime.of(date, time), zone);
@@ -333,7 +333,7 @@ public static ZonedDateTime of(LocalDateTime localDateTime, ZoneId zone) {
333333
* @param second the second-of-minute to represent, from 0 to 59
334334
* @param nanoOfSecond the nano-of-second to represent, from 0 to 999,999,999
335335
* @param zone the time-zone, not null
336-
* @return the offset date-time, not null
336+
* @return the zoned date-time, not null
337337
* @throws DateTimeException if the value of any field is out of range, or
338338
* if the day-of-month is invalid for the month-year
339339
*/

src/java.base/share/classes/java/time/package-info.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -65,7 +65,7 @@
6565
* The main API for dates, times, instants, and durations.
6666
* </p>
6767
* <p>
68-
* The classes defined here represent the principle date-time concepts,
68+
* The classes defined here represent the principal date-time concepts,
6969
* including instants, durations, dates, times, time-zones and periods.
7070
* They are based on the ISO calendar system, which is the <i>de facto</i> world
7171
* calendar following the proleptic Gregorian rules.
@@ -150,7 +150,7 @@
150150
* </p>
151151
* <p>
152152
* {@link java.time.OffsetTime} stores a time and offset from UTC without a date.
153-
* This stores a date like '11:30+01:00'.
153+
* This stores a time like '11:30+01:00'.
154154
* The {@link java.time.ZoneOffset ZoneOffset} is of the form '+01:00'.
155155
* </p>
156156
* <p>
@@ -249,7 +249,7 @@
249249
* <p>
250250
* Multiple calendar systems is an awkward addition to the design challenges.
251251
* The first principle is that most users want the standard ISO calendar system.
252-
* As such, the main classes are ISO-only. The second principle is that most of those that want a
252+
* As such, the main classes are ISO-only. The second principle is that most of those who want a
253253
* non-ISO calendar system want it for user interaction, thus it is a UI localization issue.
254254
* As such, date and time objects should be held as ISO objects in the data model and persistent
255255
* storage, only being converted to and from a local calendar for display.

src/java.base/share/classes/java/time/temporal/ChronoField.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -599,7 +599,7 @@ public enum ChronoField implements TemporalField {
599599
* A {@link ZoneOffset} represents the period of time that local time differs from UTC/Greenwich.
600600
* This is usually a fixed number of hours and minutes.
601601
* It is equivalent to the {@link ZoneOffset#getTotalSeconds() total amount} of the offset in seconds.
602-
* For example, during the winter Paris has an offset of {@code +01:00}, which is 3600 seconds.
602+
* For example, during the winter, Paris has an offset of {@code +01:00}, which is 3,600 seconds.
603603
* <p>
604604
* This field is strictly defined to have the same meaning in all calendar systems.
605605
* This is necessary to ensure interoperation between calendars.

src/java.base/share/classes/java/time/temporal/ValueRange.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
* Only the minimum and maximum values are provided.
7979
* It is possible for there to be invalid values within the outer range.
8080
* For example, a weird field may have valid values of 1, 2, 4, 6, 7, thus
81-
* have a range of '1 - 7', despite that fact that values 3 and 5 are invalid.
81+
* have a range of '1 - 7', despite the fact that values 3 and 5 are invalid.
8282
* <p>
8383
* Instances of this class are not tied to a specific field.
8484
*

0 commit comments

Comments
 (0)