]> gitweb.fperrin.net Git - Dictionary.git/blobdiff - jars/icu4j-52_1/main/classes/core/src/com/ibm/icu/text/ChineseDateFormatSymbols.java
Upgrade ICU4J.
[Dictionary.git] / jars / icu4j-52_1 / main / classes / core / src / com / ibm / icu / text / ChineseDateFormatSymbols.java
similarity index 71%
rename from jars/icu4j-4_8_1_1/main/classes/core/src/com/ibm/icu/text/ChineseDateFormatSymbols.java
rename to jars/icu4j-52_1/main/classes/core/src/com/ibm/icu/text/ChineseDateFormatSymbols.java
index b5b075d3eccd81d426324158b958dff30e19d549..a606973b17af9154a755f11e877ca0b973cca9d4 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (C) 2000-2011, International Business Machines Corporation and
+ * Copyright (C) 2000-2013, International Business Machines Corporation and
  * others. All Rights Reserved.
  ****************************************************************************
  */
@@ -22,7 +22,7 @@ import com.ibm.icu.util.ULocale.Category;
  * @see ChineseDateFormat
  * @see com.ibm.icu.util.ChineseCalendar
  * @author Alan Liu
- * @stable ICU 2.0
+ * @deprecated ICU 50 
  */
 public class ChineseDateFormatSymbols extends DateFormatSymbols {
     // Generated by serialver from JDK 1.4.1_01
@@ -32,12 +32,12 @@ public class ChineseDateFormatSymbols extends DateFormatSymbols {
      * Package-private array that ChineseDateFormat needs to be able to
      * read.
      */
-    String isLeapMonth[]; // Do NOT add =null initializer
+    String[] isLeapMonth;
 
     /**
      * Construct a ChineseDateFormatSymbols for the default <code>FORMAT</code> locale.
      * @see Category#FORMAT
-     * @stable ICU 2.0
+     * @deprecated ICU 50
      */
     public ChineseDateFormatSymbols() {
         this(ULocale.getDefault(Category.FORMAT));
@@ -46,7 +46,7 @@ public class ChineseDateFormatSymbols extends DateFormatSymbols {
     /**
      * Construct a ChineseDateFormatSymbols for the provided locale.
      * @param locale the locale
-     * @stable ICU 2.0
+     * @deprecated ICU 50
      */
     public ChineseDateFormatSymbols(Locale locale) {
         super(ChineseCalendar.class, ULocale.forLocale(locale));
@@ -55,7 +55,7 @@ public class ChineseDateFormatSymbols extends DateFormatSymbols {
     /**
      * Construct a ChineseDateFormatSymbols for the provided locale.
      * @param locale the locale
-     * @stable ICU 3.2
+     * @deprecated ICU 50
      */
     public ChineseDateFormatSymbols(ULocale locale) {
         super(ChineseCalendar.class, locale);
@@ -65,25 +65,27 @@ public class ChineseDateFormatSymbols extends DateFormatSymbols {
      * Construct a ChineseDateFormatSymbols for the provided calendar and locale.
      * @param cal the Calendar
      * @param locale the locale
-     * @stable ICU 2.0
+     * @deprecated ICU 50
      */
     public ChineseDateFormatSymbols(Calendar cal, Locale locale) {
-        super(cal==null?null:cal.getClass(), locale);
+        // NPE is thrown here when cal is null, like the super class does
+        super(cal.getClass(), locale);
     }
 
     /**
      * Construct a ChineseDateFormatSymbols for the provided calendar and locale.
      * @param cal the Calendar
      * @param locale the locale
-     * @stable ICU 3.2
+     * @deprecated ICU 50
      */
     public ChineseDateFormatSymbols(Calendar cal, ULocale locale) {
-        super(cal == null ? null : cal.getClass(), locale);
+        // NPE is thrown here when cal is null, like the super class does
+        super(cal.getClass(), locale);
     }
 
     // New API
     /**
-     * @stable ICU 2.0
+     * @deprecated ICU 50
      */
     public String getLeapMonth(int leap) {
         return isLeapMonth[leap];
@@ -91,17 +93,30 @@ public class ChineseDateFormatSymbols extends DateFormatSymbols {
 
     /**
      * {@inheritDoc}
-     * @stable ICU 3.0
+     * @deprecated ICU 50
      */
     protected void initializeData(ULocale loc, CalendarData calData) {
         super.initializeData(loc, calData);
-        isLeapMonth = calData.getStringArray("isLeapMonth");
+        initializeIsLeapMonth();
     }
 
     void initializeData(DateFormatSymbols dfs) {
         super.initializeData(dfs);
         if (dfs instanceof ChineseDateFormatSymbols) {
+            // read-only array, no need to clone
             this.isLeapMonth = ((ChineseDateFormatSymbols)dfs).isLeapMonth;
+        } else {
+            initializeIsLeapMonth();
         }
     }
+
+    private void initializeIsLeapMonth() {
+        // The old way, obsolete:
+        //isLeapMonth = calData.getStringArray("isLeapMonth");
+        // The new way to fake this for backward compatibility (no longer used to format/parse):
+
+        isLeapMonth = new String[2];
+        isLeapMonth[0] = "";
+        isLeapMonth[1] = (leapMonthPatterns != null)? leapMonthPatterns[DT_LEAP_MONTH_PATTERN_FORMAT_WIDE].replace("{0}", ""): "";
+    }
 }