diff -r a7f16447085e -r 48e480e56aad src/java.base/share/classes/java/text/SimpleDateFormat.java --- a/src/java.base/share/classes/java/text/SimpleDateFormat.java Tue Sep 24 10:04:13 2019 +0000 +++ b/src/java.base/share/classes/java/text/SimpleDateFormat.java Tue Sep 24 09:43:43 2019 +0100 @@ -58,19 +58,19 @@ import sun.util.locale.provider.TimeZoneNameUtility; /** - * SimpleDateFormat is a concrete class for formatting and + * {@code SimpleDateFormat} is a concrete class for formatting and * parsing dates in a locale-sensitive manner. It allows for formatting * (date → text), parsing (text → date), and normalization. * *

- * SimpleDateFormat allows you to start by choosing + * {@code SimpleDateFormat} allows you to start by choosing * any user-defined patterns for date-time formatting. However, you * are encouraged to create a date-time formatter with either - * getTimeInstance, getDateInstance, or - * getDateTimeInstance in DateFormat. Each + * {@code getTimeInstance}, {@code getDateInstance}, or + * {@code getDateTimeInstance} in {@code DateFormat}. Each * of these class methods can return a date/time formatter initialized * with a default format pattern. You may modify the format pattern - * using the applyPattern methods as desired. + * using the {@code applyPattern} methods as desired. * For more information on using these methods, see * {@link DateFormat}. * @@ -79,19 +79,19 @@ * Date and time formats are specified by date and time pattern * strings. * Within date and time pattern strings, unquoted letters from - * 'A' to 'Z' and from 'a' to - * 'z' are interpreted as pattern letters representing the + * {@code 'A'} to {@code 'Z'} and from {@code 'a'} to + * {@code 'z'} are interpreted as pattern letters representing the * components of a date or time string. - * Text can be quoted using single quotes (') to avoid + * Text can be quoted using single quotes ({@code '}) to avoid * interpretation. - * "''" represents a single quote. + * {@code "''"} represents a single quote. * All other characters are not interpreted; they're simply copied into the * output string during formatting or matched against the input string * during parsing. *

* The following pattern letters are defined (all other characters from - * 'A' to 'Z' and from 'a' to - * 'z' are reserved): + * {@code 'A'} to {@code 'Z'} and from {@code 'a'} to + * {@code 'z'} are reserved): *

* * @@ -104,120 +104,120 @@ * * * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * *
Chart shows pattern letters, date/time component, presentation, and examples.
G + * {@code G} * Era designator * Text - * AD + * {@code AD} *
y + * {@code y} * Year * Year - * 1996; 96 + * {@code 1996}; {@code 96} *
Y + * {@code Y} * Week year * Year - * 2009; 09 + * {@code 2009}; {@code 09} *
M + * {@code M} * Month in year (context sensitive) * Month - * July; Jul; 07 + * {@code July}; {@code Jul}; {@code 07} *
L + * {@code L} * Month in year (standalone form) * Month - * July; Jul; 07 + * {@code July}; {@code Jul}; {@code 07} *
w + * {@code w} * Week in year * Number - * 27 + * {@code 27} *
W + * {@code W} * Week in month * Number - * 2 + * {@code 2} *
D + * {@code D} * Day in year * Number - * 189 + * {@code 189} *
d + * {@code d} * Day in month * Number - * 10 + * {@code 10} *
F + * {@code F} * Day of week in month * Number - * 2 + * {@code 2} *
E + * {@code E} * Day name in week * Text - * Tuesday; Tue + * {@code Tuesday}; {@code Tue} *
u + * {@code u} * Day number of week (1 = Monday, ..., 7 = Sunday) * Number - * 1 + * {@code 1} *
a + * {@code a} * Am/pm marker * Text - * PM + * {@code PM} *
H + * {@code H} * Hour in day (0-23) * Number - * 0 + * {@code 0} *
k + * {@code k} * Hour in day (1-24) * Number - * 24 + * {@code 24} *
K + * {@code K} * Hour in am/pm (0-11) * Number - * 0 + * {@code 0} *
h + * {@code h} * Hour in am/pm (1-12) * Number - * 12 + * {@code 12} *
m + * {@code m} * Minute in hour * Number - * 30 + * {@code 30} *
s + * {@code s} * Second in minute * Number - * 55 + * {@code 55} *
S + * {@code S} * Millisecond * Number - * 978 + * {@code 978} *
z + * {@code z} * Time zone * General time zone - * Pacific Standard Time; PST; GMT-08:00 + * {@code Pacific Standard Time}; {@code PST}; {@code GMT-08:00} *
Z + * {@code Z} * Time zone * RFC 822 time zone - * -0800 + * {@code -0800} *
X + * {@code X} * Time zone * ISO 8601 time zone - * -08; -0800; -08:00 + * {@code -08}; {@code -0800}; {@code -08:00} *
*
@@ -247,11 +247,11 @@ * digits. So using the pattern "MM/dd/yyyy", "01/11/12" parses to * Jan 11, 12 A.D. *
  • For parsing with the abbreviated year pattern ("y" or "yy"), - * SimpleDateFormat must interpret the abbreviated year + * {@code SimpleDateFormat} must interpret the abbreviated year * relative to some century. It does this by adjusting dates to be - * within 80 years before and 20 years after the time the SimpleDateFormat + * within 80 years before and 20 years after the time the {@code SimpleDateFormat} * instance is created. For example, using a pattern of "MM/dd/yy" and a - * SimpleDateFormat instance created on Jan 1, 1997, the string + * {@code SimpleDateFormat} instance created on Jan 1, 1997, the string * "01/11/12" would be interpreted as Jan 11, 2012 while the string "05/04/64" * would be interpreted as May 4, 1964. * During parsing, only strings consisting of exactly two digits, as defined by @@ -303,16 +303,16 @@ * following syntax is used: *
      *     GMTOffsetTimeZone:
    - *             GMT Sign Hours : Minutes
    + *             {@code GMT} Sign Hours {@code :} Minutes
      *     Sign: one of
    - *             + -
    + *             {@code + -}
      *     Hours:
      *             Digit
      *             Digit Digit
      *     Minutes:
      *             Digit Digit
      *     Digit: one of
    - *             0 1 2 3 4 5 6 7 8 9
    + * {@code 0 1 2 3 4 5 6 7 8 9} * Hours must be between 0 and 23, and Minutes must be between * 00 and 59. The format is locale independent and digits must be taken * from the Basic Latin block of the Unicode standard. @@ -364,10 +364,10 @@ * SimpleDateFormat} or {@linkplain #applyPattern(String) applying a * pattern}. * - * SimpleDateFormat also supports localized date and time + * {@code SimpleDateFormat} also supports localized date and time * pattern strings. In these strings, the pattern letters described above * may be replaced with other, locale dependent, pattern letters. - * SimpleDateFormat does not deal with the localization of text + * {@code SimpleDateFormat} does not deal with the localization of text * other than the pattern letters; that's up to the client of the class. * *

    Examples

    @@ -385,38 +385,38 @@ * * * - * "yyyy.MM.dd G 'at' HH:mm:ss z" - * 2001.07.04 AD at 12:08:56 PDT + * {@code "yyyy.MM.dd G 'at' HH:mm:ss z"} + * {@code 2001.07.04 AD at 12:08:56 PDT} * - * "EEE, MMM d, ''yy" - * Wed, Jul 4, '01 + * {@code "EEE, MMM d, ''yy"} + * {@code Wed, Jul 4, '01} * - * "h:mm a" - * 12:08 PM + * {@code "h:mm a"} + * {@code 12:08 PM} * - * "hh 'o''clock' a, zzzz" - * 12 o'clock PM, Pacific Daylight Time + * {@code "hh 'o''clock' a, zzzz"} + * {@code 12 o'clock PM, Pacific Daylight Time} * - * "K:mm a, z" - * 0:08 PM, PDT + * {@code "K:mm a, z"} + * {@code 0:08 PM, PDT} * - * "yyyyy.MMMMM.dd GGG hh:mm aaa" - * 02001.July.04 AD 12:08 PM + * {@code "yyyyy.MMMMM.dd GGG hh:mm aaa"} + * {@code 02001.July.04 AD 12:08 PM} * - * "EEE, d MMM yyyy HH:mm:ss Z" - * Wed, 4 Jul 2001 12:08:56 -0700 + * {@code "EEE, d MMM yyyy HH:mm:ss Z"} + * {@code Wed, 4 Jul 2001 12:08:56 -0700} * - * "yyMMddHHmmssZ" - * 010704120856-0700 + * {@code "yyMMddHHmmssZ"} + * {@code 010704120856-0700} * - * "yyyy-MM-dd'T'HH:mm:ss.SSSZ" - * 2001-07-04T12:08:56.235-0700 + * {@code "yyyy-MM-dd'T'HH:mm:ss.SSSZ"} + * {@code 2001-07-04T12:08:56.235-0700} * - * "yyyy-MM-dd'T'HH:mm:ss.SSSXXX" - * 2001-07-04T12:08:56.235-07:00 + * {@code "yyyy-MM-dd'T'HH:mm:ss.SSSXXX"} + * {@code 2001-07-04T12:08:56.235-07:00} * - * "YYYY-'W'ww-u" - * 2001-W27-3 + * {@code "YYYY-'W'ww-u"} + * {@code 2001-W27-3} * * * @@ -453,12 +453,12 @@ * The version of the serialized data on the stream. Possible values: * * When streaming out this class, the most recent format - * and the highest allowable serialVersionOnStream + * and the highest allowable {@code serialVersionOnStream} * is written. * @serial * @since 1.1.4 @@ -523,7 +523,7 @@ /** * We map dates with two-digit years into the century starting at - * defaultCenturyStart, which may be any date. May + * {@code defaultCenturyStart}, which may be any date. May * not be null. * @serial * @since 1.1.4 @@ -546,8 +546,8 @@ /** * The Locale used to instantiate this - * SimpleDateFormat. The value may be null if this object - * has been created by an older SimpleDateFormat and + * {@code SimpleDateFormat}. The value may be null if this object + * has been created by an older {@code SimpleDateFormat} and * deserialized. * * @serial @@ -556,7 +556,7 @@ private Locale locale; /** - * Indicates whether this SimpleDateFormat should use + * Indicates whether this {@code SimpleDateFormat} should use * the DateFormatSymbols. If true, the format and parse methods * use the DateFormatSymbols values. If false, the format and * parse methods call Calendar.getDisplayName or @@ -565,7 +565,7 @@ transient boolean useDateFormatSymbols; /** - * Constructs a SimpleDateFormat using the default pattern and + * Constructs a {@code SimpleDateFormat} using the default pattern and * date format symbols for the default * {@link java.util.Locale.Category#FORMAT FORMAT} locale. * Note: This constructor may not support all locales. @@ -579,7 +579,7 @@ } /** - * Constructs a SimpleDateFormat using the given pattern and + * Constructs a {@code SimpleDateFormat} using the given pattern and * the default date format symbols for the default * {@link java.util.Locale.Category#FORMAT FORMAT} locale. * Note: This constructor may not support all locales. @@ -601,7 +601,7 @@ } /** - * Constructs a SimpleDateFormat using the given pattern and + * Constructs a {@code SimpleDateFormat} using the given pattern and * the default date format symbols for the given locale. * Note: This constructor may not support all locales. * For full coverage, use the factory methods in the {@link DateFormat} @@ -626,7 +626,7 @@ } /** - * Constructs a SimpleDateFormat using the given pattern and + * Constructs a {@code SimpleDateFormat} using the given pattern and * date format symbols. * * @param pattern the pattern describing the date and time format @@ -916,7 +916,7 @@ * to begin on the date the user specifies. * * @param startDate During parsing, two digit years will be placed in the range - * startDate to startDate + 100 years. + * {@code startDate} to {@code startDate + 100 years}. * @see #get2DigitYearStart * @throws NullPointerException if {@code startDate} is {@code null}. * @since 1.2 @@ -939,8 +939,8 @@ } /** - * Formats the given Date into a date/time string and appends - * the result to the given StringBuffer. + * Formats the given {@code Date} into a date/time string and appends + * the result to the given {@code StringBuffer}. * * @param date the date-time value to be formatted into a date-time string. * @param toAppendTo where the new date-time text is to be appended. @@ -1003,13 +1003,13 @@ } /** - * Formats an Object producing an AttributedCharacterIterator. - * You can use the returned AttributedCharacterIterator + * Formats an Object producing an {@code AttributedCharacterIterator}. + * You can use the returned {@code AttributedCharacterIterator} * to build the resulting String, as well as to determine information * about the resulting String. *

    * Each attribute key of the AttributedCharacterIterator will be of type - * DateFormat.Field, with the corresponding attribute value + * {@code DateFormat.Field}, with the corresponding attribute value * being the same as the attribute key. * * @throws NullPointerException if obj is null. @@ -1427,17 +1427,17 @@ /** - * Parses text from a string to produce a Date. + * Parses text from a string to produce a {@code Date}. *

    * The method attempts to parse text starting at the index given by - * pos. - * If parsing succeeds, then the index of pos is updated + * {@code pos}. + * If parsing succeeds, then the index of {@code pos} is updated * to the index after the last character used (parsing does not necessarily * use all characters up to the end of the string), and the parsed - * date is returned. The updated pos can be used to + * date is returned. The updated {@code pos} can be used to * indicate the starting point for the next call to this method. - * If an error occurs, then the index of pos is not - * changed, the error index of pos is set to the index of + * If an error occurs, then the index of {@code pos} is not + * changed, the error index of {@code pos} is set to the index of * the character where the error occurred, and null is returned. * *

    This parsing operation uses the {@link DateFormat#calendar @@ -1454,12 +1454,12 @@ * {@link #setTimeZone(java.util.TimeZone) setTimeZone} may need * to be restored for further operations. * - * @param text A String, part of which should be parsed. - * @param pos A ParsePosition object with index and error + * @param text A {@code String}, part of which should be parsed. + * @param pos A {@code ParsePosition} object with index and error * index information as described above. - * @return A Date parsed from the string. In case of + * @return A {@code Date} parsed from the string. In case of * error, returns null. - * @throws NullPointerException if text or pos is null. + * @throws NullPointerException if {@code text} or {@code pos} is null. */ @Override public Date parse(String text, ParsePosition pos) @@ -2393,10 +2393,10 @@ } /** - * Creates a copy of this SimpleDateFormat. This also + * Creates a copy of this {@code SimpleDateFormat}. This also * clones the format's date format symbols. * - * @return a clone of this SimpleDateFormat + * @return a clone of this {@code SimpleDateFormat} */ @Override public Object clone() { @@ -2406,9 +2406,9 @@ } /** - * Returns the hash code value for this SimpleDateFormat object. + * Returns the hash code value for this {@code SimpleDateFormat} object. * - * @return the hash code value for this SimpleDateFormat object. + * @return the hash code value for this {@code SimpleDateFormat} object. */ @Override public int hashCode() @@ -2418,11 +2418,11 @@ } /** - * Compares the given object with this SimpleDateFormat for + * Compares the given object with this {@code SimpleDateFormat} for * equality. * * @return true if the given object is equal to this - * SimpleDateFormat + * {@code SimpleDateFormat} */ @Override public boolean equals(Object obj)