8055900: j.t.SimpleDateFormat spec needs to be clarified regarding month patterns
authornishjain
Thu, 07 Jul 2016 17:53:55 +0900
changeset 39490 1450367e1082
parent 39489 ae846c9286b0
child 39491 504b835d71a8
8055900: j.t.SimpleDateFormat spec needs to be clarified regarding month patterns Reviewed-by: okutsu, peytoia
jdk/src/java.base/share/classes/java/text/DateFormatSymbols.java
jdk/src/java.base/share/classes/java/text/SimpleDateFormat.java
--- a/jdk/src/java.base/share/classes/java/text/DateFormatSymbols.java	Thu Jul 07 01:31:31 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/text/DateFormatSymbols.java	Thu Jul 07 17:53:55 2016 +0900
@@ -418,7 +418,7 @@
      * Gets short month strings. For example: "Jan", "Feb", etc.
      *
      * <p>If the language requires different forms for formatting and
-     * stand-alone usages, This method returns short month names in
+     * stand-alone usages, this method returns short month names in
      * the formatting form. For example, the preferred abbreviation
      * for January in the Catalan language is <em>de gen.</em> in the
      * formatting form, while it is <em>gen.</em> in the stand-alone
--- a/jdk/src/java.base/share/classes/java/text/SimpleDateFormat.java	Thu Jul 07 01:31:31 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/text/SimpleDateFormat.java	Thu Jul 07 17:53:55 2016 +0900
@@ -276,9 +276,16 @@
  *     it is interpreted as a <a href="#number">number</a>.<br>
  *     <ul>
  *     <li>Letter <em>M</em> produces context-sensitive month names, such as the
- *         embedded form of names. If a {@code DateFormatSymbols} has been set
- *         explicitly with constructor {@link #SimpleDateFormat(String,
- *         DateFormatSymbols)} or method {@link
+ *         embedded form of names. Letter <em>M</em> is context-sensitive in the
+ *         sense that when it is used in the standalone pattern, for example,
+ *         "MMMM", it gives the standalone form of a month name and when it is
+ *         used in the pattern containing other field(s), for example, "d MMMM",
+ *         it gives the format form of a month name. For example, January in the
+ *         Catalan language is "de gener" in the format form while it is "gener"
+ *         in the standalone form. In this case, "MMMM" will produce "gener" and
+ *         the month part of the "d MMMM" will produce "de gener". If a
+ *         {@code DateFormatSymbols} has been set explicitly with constructor
+ *         {@link #SimpleDateFormat(String,DateFormatSymbols)} or method {@link
  *         #setDateFormatSymbols(DateFormatSymbols)}, the month names given by
  *         the {@code DateFormatSymbols} are used.</li>
  *     <li>Letter <em>L</em> produces the standalone form of month names.</li>