8146656: Wrong Months Array for DateFormatSymbols

Updated API doc of DateFormatSymbols class.

Reviewed-by: rriggs, naoto
This commit is contained in:
Rachna Goel 2018-01-24 14:07:11 +05:30
parent 8dff4034fd
commit 551a0d104f

View File

@ -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 @@ public class DateFormatSymbols implements Serializable, Cloneable {
/**
* 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 @@ public class DateFormatSymbols implements Serializable, Cloneable {
* 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 @@ public class DateFormatSymbols implements Serializable, Cloneable {
/**
* 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 @@ public class DateFormatSymbols implements Serializable, Cloneable {
* 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);