8146656: Wrong Months Array for DateFormatSymbols
Summary: Updated API doc of DateFormatSymbols class.
Reviewed-by: rriggs, naoto
--- a/src/java.base/share/classes/java/text/DateFormatSymbols.java Tue Jan 23 08:26:42 2018 +0100
+++ b/src/java.base/share/classes/java/text/DateFormatSymbols.java Wed Jan 24 14:07:11 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -394,6 +394,12 @@
/**
* Gets month strings. For example: "January", "February", etc.
+ * An array with either 12 or 13 elements will be returned depending
+ * on whether or not {@link java.util.Calendar#UNDECIMBER Calendar.UNDECIMBER}
+ * is supported. Use
+ * {@link java.util.Calendar#JANUARY Calendar.JANUARY},
+ * {@link java.util.Calendar#FEBRUARY Calendar.FEBRUARY},
+ * etc. to index the result array.
*
* <p>If the language requires different forms for formatting and
* stand-alone usages, this method returns month names in the
@@ -405,10 +411,9 @@
* Calendar Elements in the Unicode Locale Data Markup Language
* (LDML) specification</a> for more details.
*
- * @return the month strings. Use
- * {@link java.util.Calendar#JANUARY Calendar.JANUARY},
- * {@link java.util.Calendar#FEBRUARY Calendar.FEBRUARY},
- * etc. to index the result array.
+ * @implSpec This method returns 13 elements since
+ * {@link java.util.Calendar#UNDECIMBER Calendar.UNDECIMBER} is supported.
+ * @return the month strings.
*/
public String[] getMonths() {
return Arrays.copyOf(months, months.length);
@@ -427,6 +432,12 @@
/**
* Gets short month strings. For example: "Jan", "Feb", etc.
+ * An array with either 12 or 13 elements will be returned depending
+ * on whether or not {@link java.util.Calendar#UNDECIMBER Calendar.UNDECIMBER}
+ * is supported. Use
+ * {@link java.util.Calendar#JANUARY Calendar.JANUARY},
+ * {@link java.util.Calendar#FEBRUARY Calendar.FEBRUARY},
+ * etc. to index the result array.
*
* <p>If the language requires different forms for formatting and
* stand-alone usages, this method returns short month names in
@@ -438,10 +449,9 @@
* Calendar Elements in the Unicode Locale Data Markup Language
* (LDML) specification</a> for more details.
*
- * @return the short month strings. Use
- * {@link java.util.Calendar#JANUARY Calendar.JANUARY},
- * {@link java.util.Calendar#FEBRUARY Calendar.FEBRUARY},
- * etc. to index the result array.
+ * @implSpec This method returns 13 elements since
+ * {@link java.util.Calendar#UNDECIMBER Calendar.UNDECIMBER} is supported.
+ * @return the short month strings.
*/
public String[] getShortMonths() {
return Arrays.copyOf(shortMonths, shortMonths.length);