From 684bbcecfe75b7ac5ce4a33ace4a28ded8c87e3b Mon Sep 17 00:00:00 2001 From: Yoshito Umaoka Date: Thu, 15 Sep 2011 01:57:16 +0000 Subject: [PATCH] ICU-8512 Prmoting previously tech preview TimeZoneNames/TimeZoneFormat APIs to draft. Implementing explicit serialization. Removed the logic for commonlyUsed flag for short names (#8811). Let TimeZoneNameImpl fail when it cannot load necessary data. X-SVN-Rev: 30659 --- .../src/com/ibm/icu/impl/TextTrieMap.java | 8 +- .../ibm/icu/impl/TimeZoneGenericNames.java | 24 +- .../com/ibm/icu/impl/TimeZoneNamesImpl.java | 103 ++---- .../com/ibm/icu/text/SimpleDateFormat.java | 12 +- .../src/com/ibm/icu/text/TimeZoneFormat.java | 332 +++++++++++------- .../src/com/ibm/icu/text/TimeZoneNames.java | 126 +++---- .../core/src/com/ibm/icu/util/TimeZone.java | 4 +- .../icu/dev/test/format/DateFormatTest.java | 52 +-- .../test/format/DateIntervalFormatTest.java | 46 +-- 9 files changed, 378 insertions(+), 329 deletions(-) diff --git a/icu4j/main/classes/core/src/com/ibm/icu/impl/TextTrieMap.java b/icu4j/main/classes/core/src/com/ibm/icu/impl/TextTrieMap.java index 412ed888555..2838b6febd1 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/impl/TextTrieMap.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/impl/TextTrieMap.java @@ -67,11 +67,11 @@ public class TextTrieMap { * longest prefix matching matching key, or null if no * matching entry is found. */ - public Iterator get(String text, int start) { + public Iterator get(CharSequence text, int start) { return get(text, start, null); } - public Iterator get(String text, int start, int[] matchLen) { + public Iterator get(CharSequence text, int start, int[] matchLen) { LongestMatchHandler handler = new LongestMatchHandler(); find(text, start, handler); if (matchLen != null && matchLen.length > 0) { @@ -80,11 +80,11 @@ public class TextTrieMap { return handler.getMatches(); } - public void find(String text, ResultHandler handler) { + public void find(CharSequence text, ResultHandler handler) { find(text, 0, handler); } - public void find(String text, int offset, ResultHandler handler) { + public void find(CharSequence text, int offset, ResultHandler handler) { CharIterator chitr = new CharIterator(text, offset, _ignoreCase); find(_root, chitr, handler); } diff --git a/icu4j/main/classes/core/src/com/ibm/icu/impl/TimeZoneGenericNames.java b/icu4j/main/classes/core/src/com/ibm/icu/impl/TimeZoneGenericNames.java index 81c6506c69c..b8db57fc8fc 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/impl/TimeZoneGenericNames.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/impl/TimeZoneGenericNames.java @@ -40,6 +40,12 @@ import com.ibm.icu.util.ULocale; */ public class TimeZoneGenericNames implements Serializable, Freezable { + // Note: This class implements Serializable, but we no longer serialize instance of + // TimeZoneGenericNames in ICU 49. ICU 4.8 com.ibm.icu.text.TimeZoneFormat used to + // serialize TimeZoneGenericNames field. TimeZoneFormat no longer read TimeZoneGenericNames + // field, we have to keep TimeZoneGenericNames Serializable. Otherwise it fails to read + // (unused) TimeZoneGenericNames serialized data. + private static final long serialVersionUID = 2729910342063468417L; /** @@ -367,7 +373,7 @@ public class TimeZoneGenericNames implements Serializable, Freezable getAvailableMetaZoneIDs() { if (METAZONE_IDS == null) { - try { - UResourceBundle bundle = UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME, "metaZones"); - UResourceBundle mapTimezones = bundle.get("mapTimezones"); - Set keys = mapTimezones.keySet(); - METAZONE_IDS = Collections.unmodifiableSet(keys); - } catch (MissingResourceException e) { - METAZONE_IDS = Collections.emptySet(); - } + UResourceBundle bundle = UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME, "metaZones"); + UResourceBundle mapTimezones = bundle.get("mapTimezones"); + Set keys = mapTimezones.keySet(); + METAZONE_IDS = Collections.unmodifiableSet(keys); } return METAZONE_IDS; } @@ -176,10 +172,10 @@ public class TimeZoneNamesImpl extends TimeZoneNames { } /* (non-Javadoc) - * @see com.ibm.icu.text.TimeZoneNames#find(java.lang.String, int, java.util.Set) + * @see com.ibm.icu.text.TimeZoneNames#find(java.lang.CharSequence, int, java.util.Set) */ @Override - public synchronized Collection find(String text, int start, EnumSet nameTypes) { + public synchronized Collection find(CharSequence text, int start, EnumSet nameTypes) { if (text == null || text.length() == 0 || start < 0 || start >= text.length()) { throw new IllegalArgumentException("bad input text or range"); } @@ -218,16 +214,9 @@ public class TimeZoneNamesImpl extends TimeZoneNames { * @param locale The locale */ private void initialize(ULocale locale) { - if (locale == null) { - return; - } - try { - ICUResourceBundle bundle = (ICUResourceBundle)ICUResourceBundle.getBundleInstance( - ICUResourceBundle.ICU_ZONE_BASE_NAME, locale); - _zoneStrings = (ICUResourceBundle)bundle.get(ZONE_STRINGS_BUNDLE); - } catch (MissingResourceException mre) { - _zoneStrings = null; - } + ICUResourceBundle bundle = (ICUResourceBundle)ICUResourceBundle.getBundleInstance( + ICUResourceBundle.ICU_ZONE_BASE_NAME, locale); + _zoneStrings = (ICUResourceBundle)bundle.get(ZONE_STRINGS_BUNDLE); _tzNamesMap = new ConcurrentHashMap(); _mzNamesMap = new ConcurrentHashMap(); @@ -263,16 +252,16 @@ public class TimeZoneNamesImpl extends TimeZoneNames { /* * The custom serialization method. - * This implementation only preserve locale used for the names. + * This implementation only preserve locale object used for the names. */ private void writeObject(ObjectOutputStream out) throws IOException { - ULocale locale = _zoneStrings == null ? null : _zoneStrings.getULocale(); + ULocale locale = _zoneStrings.getULocale(); out.writeObject(locale); } /* * The custom deserialization method. - * This implementation only read locale used by the object. + * This implementation only read locale object used by the object. */ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { ULocale locale = (ULocale)in.readObject(); @@ -411,25 +400,22 @@ public class TimeZoneNamesImpl extends TimeZoneNames { * This class stores name data for a meta zone */ private static class ZNames { - private static final ZNames EMPTY_ZNAMES = new ZNames(null, false); + private static final ZNames EMPTY_ZNAMES = new ZNames(null); private String[] _names; - private boolean _shortCommonlyUsed; private static final String[] KEYS = {"lg", "ls", "ld", "sg", "ss", "sd"}; - protected ZNames(String[] names, boolean shortCommonlyUsed) { + protected ZNames(String[] names) { _names = names; - _shortCommonlyUsed = shortCommonlyUsed; } public static ZNames getInstance(ICUResourceBundle zoneStrings, String key) { - boolean[] cu = new boolean[1]; - String[] names = loadData(zoneStrings, key, cu); + String[] names = loadData(zoneStrings, key); if (names == null) { return EMPTY_ZNAMES; } - return new ZNames(names, cu[0]); + return new ZNames(names); } public String getName(NameType type) { @@ -448,9 +434,7 @@ public class TimeZoneNamesImpl extends TimeZoneNames { name = _names[2]; break; case SHORT_GENERIC: - if (_shortCommonlyUsed) { - name = _names[3]; - } + name = _names[3]; break; case SHORT_STANDARD: name = _names[4]; @@ -458,27 +442,16 @@ public class TimeZoneNamesImpl extends TimeZoneNames { case SHORT_DAYLIGHT: name = _names[5]; break; - case SHORT_STANDARD_COMMONLY_USED: - if (_shortCommonlyUsed) { - name = _names[4]; - } - break; - case SHORT_DAYLIGHT_COMMONLY_USED: - if (_shortCommonlyUsed) { - name = _names[5]; - } - break; } return name; } - protected static String[] loadData(ICUResourceBundle zoneStrings, String key, boolean[] shortCommonlyUsed) { + protected static String[] loadData(ICUResourceBundle zoneStrings, String key) { if (zoneStrings == null || key == null || key.length() == 0) { return null; } - shortCommonlyUsed[0] = false; ICUResourceBundle table = null; try { table = zoneStrings.getWithFallback(key); @@ -501,14 +474,6 @@ public class TimeZoneNamesImpl extends TimeZoneNames { return null; } - try { - ICUResourceBundle cuRes = table.getWithFallback("cu"); - int cu = cuRes.getInt(); - shortCommonlyUsed[0] = (cu != 0); - } catch (MissingResourceException e) { - // cu is optional - } - return names; } } @@ -519,7 +484,7 @@ public class TimeZoneNamesImpl extends TimeZoneNames { private static class TZNames extends ZNames { private String _locationName; - private static final TZNames EMPTY_TZNAMES = new TZNames(null, false, null); + private static final TZNames EMPTY_TZNAMES = new TZNames(null, null); public static TZNames getInstance(ICUResourceBundle zoneStrings, String key) { if (zoneStrings == null || key == null || key.length() == 0) { @@ -540,21 +505,20 @@ public class TimeZoneNamesImpl extends TimeZoneNames { // location name is optional } - boolean[] cu = new boolean[1]; - String[] names = loadData(zoneStrings, key, cu); + String[] names = loadData(zoneStrings, key); if (locationName == null && names == null) { return EMPTY_TZNAMES; } - return new TZNames(names, cu[0], locationName); + return new TZNames(names, locationName); } public String getLocationName() { return _locationName; } - private TZNames(String[] names, boolean shortCommonlyUsed, String locationName) { - super(names, shortCommonlyUsed); + private TZNames(String[] names, String locationName) { + super(names); _locationName = locationName; } } @@ -595,11 +559,12 @@ public class TimeZoneNamesImpl extends TimeZoneNames { @Override protected List createInstance(String key, String data) { List mzMaps = null; - try { - UResourceBundle bundle = UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME, "metaZones"); - UResourceBundle metazoneInfoBundle = bundle.get("metazoneInfo"); - String tzkey = data.replace('/', ':'); + UResourceBundle bundle = UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME, "metaZones"); + UResourceBundle metazoneInfoBundle = bundle.get("metazoneInfo"); + + String tzkey = data.replace('/', ':'); + try { UResourceBundle zoneBundle = metazoneInfoBundle.get(tzkey); mzMaps = new ArrayList(zoneBundle.getSize()); @@ -619,9 +584,6 @@ public class TimeZoneNamesImpl extends TimeZoneNames { } } catch (MissingResourceException mre) { - // fall through - } - if (mzMaps == null) { mzMaps = Collections.emptyList(); } return mzMaps; @@ -704,9 +666,11 @@ public class TimeZoneNamesImpl extends TimeZoneNames { @Override protected Map createInstance(String key, String data) { Map map = null; + + UResourceBundle bundle = UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME, "metaZones"); + UResourceBundle mapTimezones = bundle.get("mapTimezones"); + try { - UResourceBundle bundle = UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME, "metaZones"); - UResourceBundle mapTimezones = bundle.get("mapTimezones"); UResourceBundle regionMap = mapTimezones.get(key); Set regions = regionMap.keySet(); @@ -717,9 +681,6 @@ public class TimeZoneNamesImpl extends TimeZoneNames { map.put(region.intern(), tzID); } } catch (MissingResourceException e) { - // fall through - } - if (map == null) { map = Collections.emptyMap(); } return map; diff --git a/icu4j/main/classes/core/src/com/ibm/icu/text/SimpleDateFormat.java b/icu4j/main/classes/core/src/com/ibm/icu/text/SimpleDateFormat.java index e64aaedf0be..7c778807b1d 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/text/SimpleDateFormat.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/text/SimpleDateFormat.java @@ -1003,7 +1003,7 @@ public class SimpleDateFormat extends DateFormat { case 17: // 'z' - ZONE_OFFSET if (count < 4) { // "z", "zz", "zzz" - result = tzFormat().format(Style.SPECIFIC_SHORT_COMMONLY_USED, tz, date); + result = tzFormat().format(Style.SPECIFIC_SHORT, tz, date); } else { result = tzFormat().format(Style.SPECIFIC_LONG, tz, date); } @@ -2043,7 +2043,7 @@ public class SimpleDateFormat extends DateFormat { case 17: // 'z' - ZONE_OFFSET { Output tzTimeType = new Output(); - Style style = (count < 4) ? Style.SPECIFIC_SHORT_COMMONLY_USED : Style.SPECIFIC_LONG; + Style style = (count < 4) ? Style.SPECIFIC_SHORT : Style.SPECIFIC_LONG; TimeZone tz = tzFormat().parse(style, text, pos, tzTimeType); if (tz != null) { if (tzTimeType.value == TimeType.STANDARD) { @@ -2347,8 +2347,8 @@ public class SimpleDateFormat extends DateFormat { * * @return the time zone formatter which this date/time * formatter uses. - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public TimeZoneFormat getTimeZoneFormat() { return tzFormat().freeze(); @@ -2358,8 +2358,8 @@ public class SimpleDateFormat extends DateFormat { * {@icu} Allows you to set the time zoen formatter. * * @param tzfmt the new time zone formatter - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public void setTimeZoneFormat(TimeZoneFormat tzfmt) { if (tzfmt.isFrozen()) { diff --git a/icu4j/main/classes/core/src/com/ibm/icu/text/TimeZoneFormat.java b/icu4j/main/classes/core/src/com/ibm/icu/text/TimeZoneFormat.java index da8bc924cf4..dca6fa8522b 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/text/TimeZoneFormat.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/text/TimeZoneFormat.java @@ -7,7 +7,10 @@ package com.ibm.icu.text; import java.io.IOException; +import java.io.InvalidObjectException; import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.ObjectStreamField; import java.io.Serializable; import java.text.AttributedCharacterIterator; import java.text.AttributedString; @@ -27,6 +30,7 @@ import com.ibm.icu.impl.SoftCache; import com.ibm.icu.impl.TimeZoneGenericNames; import com.ibm.icu.impl.TimeZoneGenericNames.GenericMatchInfo; import com.ibm.icu.impl.TimeZoneGenericNames.GenericNameType; +import com.ibm.icu.impl.TimeZoneNamesImpl; import com.ibm.icu.impl.ZoneMeta; import com.ibm.icu.lang.UCharacter; import com.ibm.icu.text.TimeZoneNames.MatchInfo; @@ -50,8 +54,8 @@ import com.ibm.icu.util.ULocale; * * @see SimpleDateFormat * @see TimeZoneNames - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public class TimeZoneFormat extends UFormat implements Freezable, Serializable { @@ -63,61 +67,52 @@ public class TimeZoneFormat extends UFormat implements Freezable * @see TimeZoneFormat#format(Style, TimeZone, long) * @see TimeZoneFormat#format(Style, TimeZone, long, Output) * @see TimeZoneFormat#parse(Style, String, ParsePosition, Output) - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public enum Style { /** * Generic location format, such as "United States Time (New York)", "Italy Time" - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ GENERIC_LOCATION, /** * Generic long non-location format, such as "Eastern Time". - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ GENERIC_LONG, /** * Generic short non-location format, such as "ET". - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ GENERIC_SHORT, /** * Specific long format, such as "Eastern Standard Time". - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ SPECIFIC_LONG, /** * Specific short format, such as "EST", "PDT". - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ SPECIFIC_SHORT, /** * RFC822 format, such as "-0500" - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ RFC822, /** * Localized GMT offset format, such as "GMT-05:00", "UTC+0100" - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ LOCALIZED_GMT, - /** - * Specific short format, such as "EST", "PDT". - *

Note: This is a variant of {@link #SPECIFIC_SHORT}, but - * excluding short abbreviations not commonly recognized by people - * for the locale. - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. - */ - SPECIFIC_SHORT_COMMONLY_USED; } /** @@ -125,32 +120,32 @@ public class TimeZoneFormat extends UFormat implements Freezable * * @see TimeZoneFormat#getGMTOffsetPattern(GMTOffsetPatternType) * @see TimeZoneFormat#setGMTOffsetPattern(GMTOffsetPatternType, String) - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public enum GMTOffsetPatternType { /** * Positive offset with hour and minute fields - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ POSITIVE_HM ("+HH:mm", "Hm", true), /** * Positive offset with hour, minute and second fields - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ POSITIVE_HMS ("+HH:mm:ss", "Hms", true), /** * Negative offset with hour and minute fields - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ NEGATIVE_HM ("-HH:mm", "Hm", false), /** * Negative offset with hour, minute and second fields - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ NEGATIVE_HMS ("-HH:mm:ss", "Hms", false); @@ -181,36 +176,35 @@ public class TimeZoneFormat extends UFormat implements Freezable * Time type enum used for receiving time type (standard time, daylight time or unknown) * in TimeZoneFormat APIs. * - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public enum TimeType { /** * Unknown - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ UNKNOWN, /** * Standard time - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ STANDARD, /** * Daylight saving time - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ DAYLIGHT; } /* - * Serialized fields + * fields to be serialized */ private ULocale _locale; private TimeZoneNames _tznames; - private volatile TimeZoneGenericNames _gnames; private String _gmtPattern; private String[] _gmtOffsetPatterns; private String[] _gmtOffsetDigits; @@ -220,6 +214,8 @@ public class TimeZoneFormat extends UFormat implements Freezable /* * Transient fields */ + private transient volatile TimeZoneGenericNames _gnames; + private transient String[] _gmtPatternTokens; private transient Object[][] _gmtOffsetPatternItems; @@ -262,8 +258,7 @@ public class TimeZoneFormat extends UFormat implements Freezable // The filter used for searching all specific names private static final EnumSet ALL_SPECIFIC_NAME_TYPES = EnumSet.of( NameType.LONG_STANDARD, NameType.LONG_DAYLIGHT, - NameType.SHORT_STANDARD, NameType.SHORT_DAYLIGHT, - NameType.SHORT_STANDARD_COMMONLY_USED, NameType.SHORT_DAYLIGHT_COMMONLY_USED + NameType.SHORT_STANDARD, NameType.SHORT_DAYLIGHT ); // The filter used for searching all generic names @@ -274,8 +269,8 @@ public class TimeZoneFormat extends UFormat implements Freezable /** * The protected constructor for subclassing. * @param locale the locale - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ protected TimeZoneFormat(ULocale locale) { _locale = locale; @@ -343,8 +338,8 @@ public class TimeZoneFormat extends UFormat implements Freezable * * @param locale the locale. * @return a frozen instance of TimeZoneFormat for the given locale. - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public static TimeZoneFormat getInstance(ULocale locale) { if (locale == null) { @@ -358,8 +353,8 @@ public class TimeZoneFormat extends UFormat implements Freezable * * @return the time zone display name data. * @see #setTimeZoneNames(TimeZoneNames) - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public TimeZoneNames getTimeZoneNames() { return _tznames; @@ -392,8 +387,8 @@ public class TimeZoneFormat extends UFormat implements Freezable * @return this object. * @throws UnsupportedOperationException when this object is frozen. * @see #getTimeZoneNames() - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public TimeZoneFormat setTimeZoneNames(TimeZoneNames tznames) { if (isFrozen()) { @@ -410,8 +405,8 @@ public class TimeZoneFormat extends UFormat implements Freezable * * @return the localized GMT format pattern. * @see #setGMTPattern(String) - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public String getGMTPattern() { return _gmtPattern; @@ -426,8 +421,8 @@ public class TimeZoneFormat extends UFormat implements Freezable * @throws IllegalArgumentException when the pattern string does not contain "{0}" * @throws UnsupportedOperationException when this object is frozen. * @see #getGMTPattern() - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public TimeZoneFormat setGMTPattern(String pattern) { if (isFrozen()) { @@ -443,8 +438,8 @@ public class TimeZoneFormat extends UFormat implements Freezable * @param type the offset pattern enum * @return the offset pattern enum. * @see #setGMTOffsetPattern(GMTOffsetPatternType, String) - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public String getGMTOffsetPattern(GMTOffsetPatternType type) { return _gmtOffsetPatterns[type.ordinal()]; @@ -459,8 +454,8 @@ public class TimeZoneFormat extends UFormat implements Freezable * @throws IllegalArgumentException when the pattern string does not have required time field letters. * @throws UnsupportedOperationException when this object is frozen. * @see #getGMTOffsetPattern(GMTOffsetPatternType) - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public TimeZoneFormat setGMTOffsetPattern(GMTOffsetPatternType type, String pattern) { if (isFrozen()) { @@ -484,8 +479,8 @@ public class TimeZoneFormat extends UFormat implements Freezable * * @return the decimal digits for localized GMT format. * @see #setGMTOffsetDigits(String) - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public String getGMTOffsetDigits() { StringBuilder buf = new StringBuilder(_gmtOffsetDigits.length); @@ -503,8 +498,8 @@ public class TimeZoneFormat extends UFormat implements Freezable * @throws IllegalArgumentException when the string did not contain ten characters. * @throws UnsupportedOperationException when this object is frozen. * @see #getGMTOffsetDigits() - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public TimeZoneFormat setGMTOffsetDigits(String digits) { if (isFrozen()) { @@ -526,8 +521,8 @@ public class TimeZoneFormat extends UFormat implements Freezable * * @return the localized GMT string string for GMT(UTC) itself. * @see #setGMTZeroFormat(String) - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public String getGMTZeroFormat() { return _gmtZeroFormat; @@ -540,8 +535,8 @@ public class TimeZoneFormat extends UFormat implements Freezable * @return this object. * @throws UnsupportedOperationException when this object is frozen. * @see #getGMTZeroFormat() - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public TimeZoneFormat setGMTZeroFormat(String gmtZeroFormat) { if (isFrozen()) { @@ -566,8 +561,8 @@ public class TimeZoneFormat extends UFormat implements Freezable * * @return true when this instance is configure for parsing all available names. * @see #setParseAllStyles(boolean) - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public boolean isParseAllStyles() { return _parseAllStyles; @@ -581,8 +576,8 @@ public class TimeZoneFormat extends UFormat implements Freezable * @return this object. * @throws UnsupportedOperationException when this object is frozen. * @see #isParseAllStyles() - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public TimeZoneFormat setParseAllStyles(boolean parseAllStyles) { if (isFrozen()) { @@ -599,8 +594,8 @@ public class TimeZoneFormat extends UFormat implements Freezable * @param offset the offset for GMT(UTC) in milliseconds. * @return the RFC822 style GMT(UTC) offset format. * @see #parseOffsetRFC822(String, ParsePosition) - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public final String formatOffsetRFC822(int offset) { StringBuilder buf = new StringBuilder(); @@ -652,8 +647,8 @@ public class TimeZoneFormat extends UFormat implements Freezable * @param offset the offset from GMT(UTC) in milliseconds. * @return the localized GMT format string * @see #parseOffsetLocalizedGMT(String, ParsePosition) - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public String formatOffsetLocalizedGMT(int offset) { if (offset == 0) { @@ -733,8 +728,8 @@ public class TimeZoneFormat extends UFormat implements Freezable * @return the display name of the time zone. * @see Style * @see #format(Style, TimeZone, long, Output) - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public final String format(Style style, TimeZone tz, long date) { return format(style, tz, date, null); @@ -755,8 +750,8 @@ public class TimeZoneFormat extends UFormat implements Freezable * @return the display name of the time zone. * @see Style * @see #format(Style, TimeZone, long) - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public String format(Style style, TimeZone tz, long date, Output timeType) { String result = null; @@ -781,9 +776,6 @@ public class TimeZoneFormat extends UFormat implements Freezable case SPECIFIC_SHORT: result = formatSpecific(tz, NameType.SHORT_STANDARD, NameType.SHORT_DAYLIGHT, date, timeType); break; - case SPECIFIC_SHORT_COMMONLY_USED: - result = formatSpecific(tz, NameType.SHORT_STANDARD_COMMONLY_USED, NameType.SHORT_DAYLIGHT_COMMONLY_USED, date, timeType); - break; case RFC822: case LOCALIZED_GMT: // will be handled below @@ -823,8 +815,8 @@ public class TimeZoneFormat extends UFormat implements Freezable * @return the offset from GMT(UTC) in milliseconds for the given RFC822 style * time zone string. * @see #formatOffsetRFC822(int) - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public final int parseOffsetRFC822(String text, ParsePosition pos) { int start = pos.getIndex(); @@ -922,8 +914,8 @@ public class TimeZoneFormat extends UFormat implements Freezable * @return the offset from GMT(UTC) in milliseconds for the given localized GMT * offset format string. * @see #formatOffsetLocalizedGMT(int) - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public int parseOffsetLocalizedGMT(String text, ParsePosition pos) { return parseOffsetLocalizedGMT(text, pos, null); @@ -948,8 +940,8 @@ public class TimeZoneFormat extends UFormat implements Freezable * @see Style * @see #format(Style, TimeZone, long, Output) * @see #setParseAllStyles(boolean) - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public TimeZone parse(Style style, String text, ParsePosition pos, Output timeType) { return parse(style, text, pos, _parseAllStyles, timeType); @@ -966,8 +958,8 @@ public class TimeZoneFormat extends UFormat implements Freezable * @param pos the position. * @return A TimeZone, or null if the input could not be parsed. * @see #parse(Style, String, ParsePosition, Output) - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public final TimeZone parse(String text, ParsePosition pos) { return parse(Style.GENERIC_LOCATION, text, pos, true, null); @@ -980,8 +972,8 @@ public class TimeZoneFormat extends UFormat implements Freezable * @throws ParseException when the input could not be parsed as a time zone string. * @see #parse(String, ParsePosition) * @see #parse(Style, String, ParsePosition, Output) - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public final TimeZone parse(String text) throws ParseException { ParsePosition pos = new ParsePosition(0); @@ -996,8 +988,8 @@ public class TimeZoneFormat extends UFormat implements Freezable /** * {@inheritDoc} * - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ @Override public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { @@ -1028,8 +1020,8 @@ public class TimeZoneFormat extends UFormat implements Freezable /** * {@inheritDoc} * - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ @Override public AttributedCharacterIterator formatToCharacterIterator(Object obj) { @@ -1047,8 +1039,8 @@ public class TimeZoneFormat extends UFormat implements Freezable /** * {@inheritDoc} * - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ @Override public Object parseObject(String source, ParsePosition pos) { @@ -1067,8 +1059,8 @@ public class TimeZoneFormat extends UFormat implements Freezable * @return the time zone's specific format name string */ private String formatSpecific(TimeZone tz, NameType stdType, NameType dstType, long date, Output timeType) { - assert(stdType == NameType.LONG_STANDARD || stdType == NameType.SHORT_STANDARD || stdType == NameType.SHORT_STANDARD_COMMONLY_USED); - assert(dstType == NameType.LONG_DAYLIGHT || dstType == NameType.SHORT_DAYLIGHT || dstType == NameType.SHORT_DAYLIGHT_COMMONLY_USED); + assert(stdType == NameType.LONG_STANDARD || stdType == NameType.SHORT_STANDARD); + assert(dstType == NameType.LONG_DAYLIGHT || dstType == NameType.SHORT_DAYLIGHT); boolean isDaylight = tz.inDaylightTime(new Date(date)); String name = isDaylight? @@ -1137,7 +1129,7 @@ public class TimeZoneFormat extends UFormat implements Freezable } // Find the best match within names which are possibly produced by the style - if (style == Style.SPECIFIC_LONG || style == Style.SPECIFIC_SHORT || style == Style.SPECIFIC_SHORT_COMMONLY_USED) { + if (style == Style.SPECIFIC_LONG || style == Style.SPECIFIC_SHORT) { // Specific styles EnumSet nameTypes = null; switch (style) { @@ -1147,9 +1139,6 @@ public class TimeZoneFormat extends UFormat implements Freezable case SPECIFIC_SHORT: nameTypes = EnumSet.of(NameType.SHORT_STANDARD, NameType.SHORT_DAYLIGHT); break; - case SPECIFIC_SHORT_COMMONLY_USED: - nameTypes = EnumSet.of(NameType.SHORT_STANDARD_COMMONLY_USED, NameType.SHORT_DAYLIGHT_COMMONLY_USED); - break; } Collection specificMatches = _tznames.find(text, startIdx, nameTypes); if (specificMatches != null) { @@ -1317,12 +1306,10 @@ public class TimeZoneFormat extends UFormat implements Freezable switch (nameType) { case LONG_STANDARD: case SHORT_STANDARD: - case SHORT_STANDARD_COMMONLY_USED: return TimeType.STANDARD; case LONG_DAYLIGHT: case SHORT_DAYLIGHT: - case SHORT_DAYLIGHT_COMMONLY_USED: return TimeType.DAYLIGHT; } return TimeType.UNKNOWN; @@ -2039,17 +2026,122 @@ public class TimeZoneFormat extends UFormat implements Freezable } /** - * Custom readObject for initializing transient fields. + * @serialField _locale ULocale The locale of this TimeZoneFormat object. + * @serialField _tznames TimeZoneNames The time zone name data. + * @serialField _gmtPattern String The pattern string for localized GMT format. + * @serialField _gmtOffsetPatterns Stirng[] The array of GMT offset patterns used by localized GMT format + * (positive hour-min, positive hour-min-sec, negative hour-min, negative hour-min-sec). + * @serialField _gmtOffsetDigits String[] The array of decimal digits used by localized GMT format + * (the size of array is 10). + * @serialField _gmtZeroFormat String The localized GMT string used for GMT(UTC). + * @serialField _parseAllStyles boolean true if this TimeZoneFormat object is configure + * for parsing all available names. + */ + private static final ObjectStreamField[] serialPersistentFields = { + new ObjectStreamField("_locale", ULocale.class), + new ObjectStreamField("_tznames", TimeZoneNames.class), + new ObjectStreamField("_gmtPattern", String.class), + new ObjectStreamField("_gmtOffsetPatterns", String[].class), + new ObjectStreamField("_gmtOffsetDigits", String[].class), + new ObjectStreamField("_gmtZeroFormat", String.class), + new ObjectStreamField("_parseAllStyles", boolean.class), + }; + + /** + * + * @param oos the object output stream + * @throws IOException + */ + private void writeObject(ObjectOutputStream oos) throws IOException { + ObjectOutputStream.PutField fields = oos.putFields(); + + fields.put("_locale", _locale); + fields.put("_tznames", _tznames); + fields.put("_gmtPattern", _gmtPattern); + fields.put("_gmtOffsetPatterns", _gmtOffsetPatterns); + fields.put("_gmtOffsetDigits", _gmtOffsetDigits); + fields.put("_gmtZeroFormat", _gmtZeroFormat); + fields.put("_parseAllStyles", _parseAllStyles); + + oos.writeFields(); + } + + /** * * @param ois the object input stream * @throws ClassNotFoundException * @throws IOException */ private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException { - ois.defaultReadObject(); + ObjectInputStream.GetField fields = ois.readFields(); + + _locale = (ULocale)fields.get("_locale", null); + if (_locale == null) { + throw new InvalidObjectException("Missing field: locale"); + } + + _tznames = (TimeZoneNames)fields.get("_tznames", null); + if (_tznames == null) { + throw new InvalidObjectException("Missing field: tznames"); + } + + _gmtPattern = (String)fields.get("_gmtPattern", null); + if (_gmtPattern == null) { + throw new InvalidObjectException("Missing field: gmtPattern"); + } + + _gmtOffsetPatterns = (String[])fields.get("_gmtOffsetPatterns", null); + if (_gmtOffsetPatterns == null) { + throw new InvalidObjectException("Missing field: gmtOffsetPatterns"); + } else if (_gmtOffsetPatterns.length < 4) { + throw new InvalidObjectException("Incompatible field: gmtOffsetPatterns"); + } + + _gmtOffsetDigits = (String[])fields.get("_gmtOffsetDigits", null); + if (_gmtOffsetDigits == null) { + throw new InvalidObjectException("Missing field: gmtOffsetDigits"); + } else if (_gmtOffsetDigits.length != 10) { + throw new InvalidObjectException("Incompatible field: gmtOffsetDigits"); + } + _gmtZeroFormat = (String)fields.get("_gmtZeroFormat", null); + if (_gmtZeroFormat == null) { + throw new InvalidObjectException("Missing field: gmtZeroFormat"); + } + + _parseAllStyles = (boolean)fields.get("_parseAllStyles", false); + if (fields.defaulted("_parseAllStyles")) { + throw new InvalidObjectException("Missing field: parseAllStyles"); + } + + // Optimization for TimeZoneNames + // + // Note: + // + // com.ibm.icu.impl.TimeZoneNamesImpl is a read-only object initialized + // by locale only. But it loads time zone names from resource bundles and + // builds trie for parsing. We want to keep TimeZoneNamesImpl as singleton + // per locale. We cannot do this for custom TimeZoneNames provided by user. + // + // com.ibm.icu.impl.TimeZoneGenericNames is a runtime generated object + // initialized by ULocale and TimeZoneNames. Like TimeZoneNamesImpl, it + // also composes time zone names and trie for parsing. We also want to keep + // TimeZoneGenericNames as siongleton per locale. If TimeZoneNames is + // actually a TimeZoneNamesImpl, we can reuse cached TimeZoneGenericNames + // instance. + if (_tznames instanceof TimeZoneNamesImpl) { + _tznames = TimeZoneNames.getInstance(_locale); + _gnames = null; // will be created by _locale later when necessary + } else { + // Custom TimeZoneNames implementation is used. We need to create + // a new instance of TimeZoneGenericNames here. + _gnames = new TimeZoneGenericNames(_locale, _tznames); + } + + // Transient fields requiring initialization initGMTPattern(_gmtPattern); initGMTOffsetPatterns(_gmtOffsetPatterns); + } /** @@ -2070,8 +2162,8 @@ public class TimeZoneFormat extends UFormat implements Freezable /** * {@inheritDoc} - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public boolean isFrozen() { return _frozen; @@ -2079,8 +2171,8 @@ public class TimeZoneFormat extends UFormat implements Freezable /** * {@inheritDoc} - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public TimeZoneFormat freeze() { _frozen = true; @@ -2089,8 +2181,8 @@ public class TimeZoneFormat extends UFormat implements Freezable /** * {@inheritDoc} - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public TimeZoneFormat cloneAsThawed() { TimeZoneFormat copy = (TimeZoneFormat)super.clone(); diff --git a/icu4j/main/classes/core/src/com/ibm/icu/text/TimeZoneNames.java b/icu4j/main/classes/core/src/com/ibm/icu/text/TimeZoneNames.java index c66b7e9fc9b..6c32ee4db21 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/text/TimeZoneNames.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/text/TimeZoneNames.java @@ -63,8 +63,8 @@ import com.ibm.icu.util.ULocale; * may provide time zone names only through {@link #getTimeZoneDisplayName(String, NameType)}, or only through * {@link #getMetaZoneDisplayName(String, NameType)}, or both. * - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public abstract class TimeZoneNames implements Serializable { @@ -73,70 +73,52 @@ public abstract class TimeZoneNames implements Serializable { /** * Time zone display name types * - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public enum NameType { /** * Long display name, such as "Eastern Time". * - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ LONG_GENERIC, /** * Long display name for standard time, such as "Eastern Standard Time". * - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ LONG_STANDARD, /** * Long display name for daylight saving time, such as "Eastern Daylight Time". * - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ LONG_DAYLIGHT, /** * Short display name, such as "ET". * - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ SHORT_GENERIC, /** * Short display name for standard time, such as "EST". * - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ SHORT_STANDARD, /** * Short display name for daylight saving time, such as "EDT". * - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ SHORT_DAYLIGHT, - /** - * Short display name for standard time, such as "EST". - *

Note: The short abbreviation might not be well understood by people not familiar with the zone. - * Unlike {@link #SHORT_STANDARD}, this type excludes short standard names not commonly used by the region. - * - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. - */ - SHORT_STANDARD_COMMONLY_USED, - /** - * Short display name for daylight saving time, such as "EDT". - *

Note: The short abbreviation might not be well understood by people not familiar with the zone. - * Unlike {@link #SHORT_DAYLIGHT}, this type excludes short daylight names not commonly used by the region. - * - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. - */ - SHORT_DAYLIGHT_COMMONLY_USED } private static Cache TZNAMES_CACHE = new Cache(); @@ -178,8 +160,8 @@ public abstract class TimeZoneNames implements Serializable { * @param locale * The locale. * @return An instance of TimeZoneDisplayNames - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public static TimeZoneNames getInstance(ULocale locale) { String key = locale.getBaseName(); @@ -189,8 +171,8 @@ public abstract class TimeZoneNames implements Serializable { /** * Returns an immutable set of all available meta zone IDs. * @return An immutable set of all available meta zone IDs. - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public abstract Set getAvailableMetaZoneIDs(); @@ -200,8 +182,8 @@ public abstract class TimeZoneNames implements Serializable { * @param tzID * The canonical time zone ID. * @return An immutable set of all available meta zone IDs used by the given time zone. - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public abstract Set getAvailableMetaZoneIDs(String tzID); @@ -215,8 +197,8 @@ public abstract class TimeZoneNames implements Serializable { * @return The meta zone ID for the given time zone ID at the given date. If the time zone does not have a * corresponding meta zone at the given date or the implementation does not support meta zones, null is * returned. - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public abstract String getMetaZoneID(String tzID, long date); @@ -229,8 +211,8 @@ public abstract class TimeZoneNames implements Serializable { * The region. * @return The reference zone ID ("golden zone" in the LDML specification) for the given time zone ID for the * region. If the meta zone is unknown or the implementation does not support meta zones, null is returned. - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public abstract String getReferenceZoneID(String mzID, String region); @@ -244,8 +226,8 @@ public abstract class TimeZoneNames implements Serializable { * @return The display name of the meta zone. When this object does not have a localized display name for the given * meta zone with the specified type or the implementation does not provide any display names associated * with meta zones, null is returned. - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public abstract String getMetaZoneDisplayName(String mzID, NameType type); @@ -265,8 +247,8 @@ public abstract class TimeZoneNames implements Serializable { * The date * @return The display name for the time zone at the given date. When this object does not have a localized display * name for the time zone with the specified type and date, null is returned. - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public final String getDisplayName(String tzID, NameType type, long date) { String name = getTimeZoneDisplayName(tzID, type); @@ -287,8 +269,8 @@ public abstract class TimeZoneNames implements Serializable { * The display name type. See {@link TimeZoneNames.NameType}. * @return The display name for the time zone. When this object does not have a localized display name for the given * time zone with the specified type, null is returned. - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public abstract String getTimeZoneDisplayName(String tzID, NameType type); @@ -309,8 +291,8 @@ public abstract class TimeZoneNames implements Serializable { * The canonical time zone ID * @return The exemplar location name for the given time zone, or null when a localized location name is not * available and the fallback logic described above cannot extract location from the ID. - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public String getExemplarLocationName(String tzID) { if (tzID == null || tzID.length() == 0 || LOC_EXCLUSION_PATTERN.matcher(tzID).matches()) { @@ -336,18 +318,18 @@ public abstract class TimeZoneNames implements Serializable { * @return A collection of matches. * @see NameType * @see MatchInfo - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ - public Collection find(String text, int start, EnumSet types) { + public Collection find(CharSequence text, int start, EnumSet types) { throw new UnsupportedOperationException("The method is not implemented in TimeZoneNames base class."); } /** * A MatchInfo represents a time zone name match used by - * {@link TimeZoneNames#find(String, int, EnumSet)}. - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * {@link TimeZoneNames#find(CharSequence, int, EnumSet)}. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public static class MatchInfo { private NameType _nameType; @@ -366,8 +348,8 @@ public abstract class TimeZoneNames implements Serializable { * or 2) both tzID and mzID are null, * or 3) matchLength is 0 or smaller. * @see NameType - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public MatchInfo(NameType nameType, String tzID, String mzID, int matchLength) { if (nameType == null) { @@ -393,8 +375,8 @@ public abstract class TimeZoneNames implements Serializable { * * @return the time zone ID, or null. * @see #mzID() - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public String tzID() { return _tzID; @@ -408,8 +390,8 @@ public abstract class TimeZoneNames implements Serializable { * * @return the meta zone ID, or null. * @see #tzID() - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public String mzID() { return _mzID; @@ -419,8 +401,8 @@ public abstract class TimeZoneNames implements Serializable { * Returns the time zone name type. * @return the time zone name type enum. * @see NameType - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public NameType nameType() { return _nameType; @@ -429,8 +411,8 @@ public abstract class TimeZoneNames implements Serializable { /** * Returns the match length. * @return the match length. - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ public int matchLength() { return _matchLength; @@ -440,8 +422,8 @@ public abstract class TimeZoneNames implements Serializable { /** * Sole constructor for invocation by subclass constructors. * - * @internal ICU 4.8 technology preview - * @deprecated This API might change or be removed in a future release. + * @draft ICU 49 + * @provisional This API might change or be removed in a future release. */ protected TimeZoneNames() { } @@ -545,10 +527,10 @@ public abstract class TimeZoneNames implements Serializable { } /* (non-Javadoc) - * @see com.ibm.icu.text.TimeZoneNames#find(java.lang.String, int, com.ibm.icu.text.TimeZoneNames.NameType[]) + * @see com.ibm.icu.text.TimeZoneNames#find(java.lang.CharSequence, int, com.ibm.icu.text.TimeZoneNames.NameType[]) */ @Override - public Collection find(String text, int start, EnumSet nameTypes) { + public Collection find(CharSequence text, int start, EnumSet nameTypes) { return Collections.emptyList(); } diff --git a/icu4j/main/classes/core/src/com/ibm/icu/util/TimeZone.java b/icu4j/main/classes/core/src/com/ibm/icu/util/TimeZone.java index 604f80b3539..debdaf05d70 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/util/TimeZone.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/util/TimeZone.java @@ -545,10 +545,8 @@ abstract public class TimeZone implements Serializable, Cloneable { nameType = daylight ? NameType.LONG_DAYLIGHT : NameType.LONG_STANDARD; break; case SHORT: - nameType = daylight ? NameType.SHORT_DAYLIGHT : NameType.SHORT_STANDARD; - break; case SHORT_COMMONLY_USED: - nameType = daylight ? NameType.SHORT_DAYLIGHT_COMMONLY_USED : NameType.SHORT_STANDARD_COMMONLY_USED; + nameType = daylight ? NameType.SHORT_DAYLIGHT : NameType.SHORT_STANDARD; break; } result = tznames.getDisplayName(ZoneMeta.getCanonicalCLDRID(this), nameType, date); diff --git a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DateFormatTest.java b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DateFormatTest.java index f6f0decac14..63003fb8b44 100644 --- a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DateFormatTest.java +++ b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DateFormatTest.java @@ -747,29 +747,29 @@ public class DateFormatTest extends com.ibm.icu.dev.test.TestFmwk { { "en", "Australia/ACT", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" }, { "en", "Australia/ACT", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" }, - { "en", "Australia/ACT", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" }, + { "en", "Australia/ACT", "2004-01-15T00:00:00Z", "z", "AEDT", "+11:00" }, { "en", "Australia/ACT", "2004-01-15T00:00:00Z", "V", "AEDT", "+11:00" }, { "en", "Australia/ACT", "2004-01-15T00:00:00Z", "zzzz", "Australian Eastern Daylight Time", "+11:00" }, { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" }, { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" }, - { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" }, + { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "z", "AEST", "+10:00" }, { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "V", "AEST", "+10:00" }, { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "zzzz", "Australian Eastern Standard Time", "+10:00" }, - { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "v", "Australia Time (Sydney)", "Australia/Sydney" }, + { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "v", "AET", "Australia/Sydney" }, { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "vvvv", "Eastern Australia Time", "Australia/Sydney" }, { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "VVVV", "Australia Time (Sydney)", "Australia/Sydney" }, { "en", "Australia/Sydney", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" }, { "en", "Australia/Sydney", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" }, - { "en", "Australia/Sydney", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" }, + { "en", "Australia/Sydney", "2004-01-15T00:00:00Z", "z", "AEDT", "+11:00" }, { "en", "Australia/Sydney", "2004-01-15T00:00:00Z", "V", "AEDT", "+11:00" }, { "en", "Australia/Sydney", "2004-01-15T00:00:00Z", "zzzz", "Australian Eastern Daylight Time", "+11:00" }, { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" }, { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" }, - { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" }, + { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "z", "AEST", "+10:00" }, { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "V", "AEST", "+10:00" }, { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "zzzz", "Australian Eastern Standard Time", "+10:00" }, - { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "v", "Australia Time (Sydney)", "Australia/Sydney" }, + { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "v", "AET", "Australia/Sydney" }, { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "vvvv", "Eastern Australia Time", "Australia/Sydney" }, { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "VVVV", "Australia Time (Sydney)", "Australia/Sydney" }, @@ -780,7 +780,7 @@ public class DateFormatTest extends com.ibm.icu.dev.test.TestFmwk { { "en", "Europe/London", "2004-01-15T00:00:00Z", "zzzz", "Greenwich Mean Time", "+0:00" }, { "en", "Europe/London", "2004-07-15T00:00:00Z", "Z", "+0100", "+1:00" }, { "en", "Europe/London", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+01:00", "+1:00" }, - { "en", "Europe/London", "2004-07-15T00:00:00Z", "z", "GMT+01:00", "Europe/London" }, + { "en", "Europe/London", "2004-07-15T00:00:00Z", "z", "BST", "Europe/London" }, { "en", "Europe/London", "2004-07-15T00:00:00Z", "V", "BST", "Europe/London" }, { "en", "Europe/London", "2004-07-15T00:00:00Z", "zzzz", "British Summer Time", "Europe/London" }, // icu en.txt has exemplar city for this time zone @@ -817,13 +817,13 @@ public class DateFormatTest extends com.ibm.icu.dev.test.TestFmwk { { "de", "America/Los_Angeles", "2004-01-15T00:00:00Z", "Z", "-0800", "-8:00" }, { "de", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-08:00", "-8:00" }, - { "de", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", "GMT-08:00", "-8:00" }, + { "de", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", "PST", "-8:00" }, { "de", "America/Los_Angeles", "2004-01-15T00:00:00Z", "zzzz", "Nordamerikanische Westk\u00fcsten-Winterzeit", "-8:00" }, { "de", "America/Los_Angeles", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" }, { "de", "America/Los_Angeles", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-07:00", "-7:00" }, - { "de", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "GMT-07:00", "-7:00" }, + { "de", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "PDT", "-7:00" }, { "de", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "Nordamerikanische Westk\u00fcsten-Sommerzeit", "-7:00" }, - { "de", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "Vereinigte Staaten Zeit (Los Angeles)", "America/Los_Angeles" }, + { "de", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "PT", "America/Los_Angeles" }, { "de", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "Nordamerikanische Westk\u00fcstenzeit", "America/Los_Angeles" }, { "de", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" }, @@ -922,14 +922,14 @@ public class DateFormatTest extends com.ibm.icu.dev.test.TestFmwk { { "zh", "America/Los_Angeles", "2004-01-15T00:00:00Z", "Z", "-0800", "-8:00" }, { "zh", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZ", GMT_ZH+"-0800", "-8:00" }, - { "zh", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", GMT_ZH+"-0800", "America/Los_Angeles" }, + { "zh", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", "PST", "America/Los_Angeles" }, { "zh", "America/Los_Angeles", "2004-01-15T00:00:00Z", "zzzz", "\u592a\u5e73\u6d0b\u6807\u51c6\u65f6\u95f4", "America/Los_Angeles" }, { "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" }, { "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "ZZZZ", GMT_ZH+"-0700", "-7:00" }, - { "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", GMT_ZH+"-0700", "America/Los_Angeles" }, + { "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "PDT", "America/Los_Angeles" }, { "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "\u592a\u5e73\u6d0b\u590f\u4ee4\u65f6\u95f4", "America/Los_Angeles" }, // icu zh.txt has exemplar city for this time zone - { "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "\u7f8e\u56fd\u65f6\u95f4\uff08\u6d1b\u6749\u77f6\uff09", "America/Los_Angeles" }, + { "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "PT", "America/Los_Angeles" }, { "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "\u7f8e\u56fd\u592a\u5e73\u6d0b\u65f6\u95f4", "America/Los_Angeles" }, { "zh", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" }, @@ -1029,13 +1029,13 @@ public class DateFormatTest extends com.ibm.icu.dev.test.TestFmwk { { "hi", "America/Los_Angeles", "2004-01-15T00:00:00Z", "Z", "-0800", "-8:00" }, { "hi", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-\u0966\u096e:\u0966\u0966", "-8:00" }, - { "hi", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", "GMT-\u0966\u096e:\u0966\u0966", "-8:00" }, + { "hi", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", "PST", "-8:00" }, { "hi", "America/Los_Angeles", "2004-01-15T00:00:00Z", "zzzz", "\u092a\u094d\u0930\u0936\u093e\u0902\u0924\u0020\u092e\u093e\u0928\u0915\u0020\u0938\u092e\u092f", "-8:00" }, { "hi", "America/Los_Angeles", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" }, { "hi", "America/Los_Angeles", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-\u0966\u096d:\u0966\u0966", "-7:00" }, - { "hi", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "GMT-\u0966\u096d:\u0966\u0966", "-7:00" }, + { "hi", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "PDT", "-7:00" }, { "hi", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "\u092A\u094D\u0930\u0936\u093E\u0902\u0924 \u0926\u093F\u0935\u093E\u0935\u0932\u094B\u0915 \u0938\u092E\u092F", "-7:00" }, - { "hi", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "\u0938\u0902\u092f\u0941\u0915\u094d\u0924 \u0930\u093e\u091c\u094d\u092f \u0905\u092e\u0947\u0930\u093f\u0915\u093e \u0938\u092E\u092F (\u0932\u094b\u0938 \u090f\u0902\u091c\u093f\u0932\u0947\u0938)", "America/Los_Angeles" }, + { "hi", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "PT", "America/Los_Angeles" }, { "hi", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "\u092A\u094D\u0930\u0936\u093E\u0902\u0924 \u0938\u092E\u092F", "America/Los_Angeles" }, { "hi", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" }, @@ -1130,16 +1130,16 @@ public class DateFormatTest extends com.ibm.icu.dev.test.TestFmwk { { "bg", "America/Los_Angeles", "2004-01-15T00:00:00Z", "Z", "-0800", "-8:00" }, { "bg", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZ", GMT_BG+"-0800", "-8:00" }, - { "bg", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", GMT_BG+"-0800", "America/Los_Angeles" }, + { "bg", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", "PST", "America/Los_Angeles" }, { "bg", "America/Los_Angeles", "2004-01-15T00:00:00Z", "V", "PST", "America/Los_Angeles" }, { "bg", "America/Los_Angeles", "2004-01-15T00:00:00Z", "zzzz", "\u0422\u0438\u0445\u043E\u043E\u043A\u0435\u0430\u043D\u0441\u043A\u0430 \u0447\u0430\u0441\u043E\u0432\u0430 \u0437\u043E\u043D\u0430", "America/Los_Angeles" }, { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" }, { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "ZZZZ", GMT_BG+"-0700", "-7:00" }, - { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", GMT_BG+"-0700", "America/Los_Angeles" }, + { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "PDT", "America/Los_Angeles" }, { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "V", "PDT", "America/Los_Angeles" }, { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "\u0422\u0438\u0445\u043E\u043E\u043A\u0435\u0430\u043D\u0441\u043A\u0430 \u043B\u044F\u0442\u043D\u0430 \u0447\u0430\u0441\u043E\u0432\u0430 \u0437\u043E\u043D\u0430", "America/Los_Angeles" }, // icu bg.txt has exemplar city for this time zone - { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "\u0421\u0410\u0429 \u0432\u0440\u0435\u043C\u0435 (\u041b\u043e\u0441 \u0410\u043d\u0436\u0435\u043b\u0438\u0441)", "America/Los_Angeles" }, + { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "PT", "America/Los_Angeles" }, { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "\u0422\u0438\u0445\u043E\u043E\u043A\u0435\u0430\u043D\u0441\u043A\u043E \u0432\u0440\u0435\u043C\u0435", "America/Los_Angeles" }, { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "VVVV", "\u0421\u0410\u0429 \u0432\u0440\u0435\u043C\u0435 (\u041b\u043e\u0441 \u0410\u043d\u0436\u0435\u043b\u0438\u0441)", "America/Los_Angeles" }, @@ -1201,7 +1201,7 @@ public class DateFormatTest extends com.ibm.icu.dev.test.TestFmwk { { "bg", "Europe/London", "2004-01-15T00:00:00Z", "Z", "+0000", "+0:00" }, { "bg", "Europe/London", "2004-01-15T00:00:00Z", "ZZZZ", GMT_BG, "+0:00" }, - { "bg", "Europe/London", "2004-01-15T00:00:00Z", "z", GMT_BG, "+0:00" }, + { "bg", "Europe/London", "2004-01-15T00:00:00Z", "z", "GMT", "+0:00" }, { "bg", "Europe/London", "2004-01-15T00:00:00Z", "zzzz", "\u0427\u0430\u0441\u043E\u0432\u0430 \u0437\u043E\u043D\u0430 \u0413\u0440\u0438\u043D\u0443\u0438\u0447", "+0:00" }, { "bg", "Europe/London", "2004-07-15T00:00:00Z", "Z", "+0100", "+1:00" }, { "bg", "Europe/London", "2004-07-15T00:00:00Z", "ZZZZ", GMT_BG+"+0100", "+1:00" }, @@ -1237,16 +1237,16 @@ public class DateFormatTest extends com.ibm.icu.dev.test.TestFmwk { { "ja", "America/Los_Angeles", "2004-01-15T00:00:00Z", "Z", "-0800", "-8:00" }, { "ja", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-08:00", "-8:00" }, - { "ja", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", "GMT-08:00", "America/Los_Angeles" }, + { "ja", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", "PST", "America/Los_Angeles" }, { "ja", "America/Los_Angeles", "2004-01-15T00:00:00Z", "V", "PST", "America/Los_Angeles" }, { "ja", "America/Los_Angeles", "2004-01-15T00:00:00Z", "zzzz", "\u30a2\u30e1\u30ea\u30ab\u592a\u5e73\u6d0b\u6a19\u6e96\u6642", "America/Los_Angeles" }, { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" }, { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-07:00", "-7:00" }, - { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "GMT-07:00", "America/Los_Angeles" }, + { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "PDT", "America/Los_Angeles" }, { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "V", "PDT", "America/Los_Angeles" }, { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "\u30a2\u30e1\u30ea\u30ab\u592a\u5e73\u6d0b\u590f\u6642\u9593", "America/Los_Angeles" }, // icu ja.txt has exemplar city for this time zone - { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "\u30A2\u30E1\u30EA\u30AB\u5408\u8846\u56FD\u6642\u9593\uFF08\u30ed\u30b5\u30f3\u30bc\u30eb\u30b9\uFF09", "America/Los_Angeles" }, + { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "PT", "America/Los_Angeles" }, { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "\u30A2\u30E1\u30EA\u30AB\u592A\u5E73\u6D0B\u6642\u9593", "America/Los_Angeles" }, { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "VVVV", "\u30A2\u30E1\u30EA\u30AB\u5408\u8846\u56FD\u6642\u9593\uFF08\u30ed\u30b5\u30f3\u30bc\u30eb\u30b9\uFF09", "America/Los_Angeles" }, @@ -1352,13 +1352,13 @@ public class DateFormatTest extends com.ibm.icu.dev.test.TestFmwk { { "ti", "America/Los_Angeles", "2004-01-15T00:00:00Z", "Z", "-0800", "-8:00" }, { "ti", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-08:00", "-8:00" }, - { "ti", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", "GMT-08:00", "-8:00" }, + { "ti", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", "PST", "-8:00" }, { "ti", "America/Los_Angeles", "2004-01-15T00:00:00Z", "zzzz", "GMT-08:00", "-8:00" }, { "ti", "America/Los_Angeles", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" }, { "ti", "America/Los_Angeles", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-07:00", "-7:00" }, - { "ti", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "GMT-07:00", "-7:00" }, + { "ti", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "PDT", "-7:00" }, { "ti", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "GMT-07:00", "-7:00" }, - { "ti", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "US (Los Angeles)", "America/Los_Angeles" }, + { "ti", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "PT", "America/Los_Angeles" }, { "ti", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "US (Los Angeles)", "America/Los_Angeles" }, { "ti", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" }, diff --git a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DateIntervalFormatTest.java b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DateIntervalFormatTest.java index 31c80b6b533..96b1065766c 100644 --- a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DateIntervalFormatTest.java +++ b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DateIntervalFormatTest.java @@ -416,7 +416,7 @@ public class DateIntervalFormatTest extends com.ibm.icu.dev.test.TestFmwk { "zh", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EEEEdMMMM", "10\\u670810\\u65e5\\u661f\\u671f\\u4e09\\u81f311\\u670810\\u65e5\\u661f\\u671f\\u516d", - "zh", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "hmv", "2007\\u5e7410\\u670810\\u65e5 \\u4e0a\\u534810:10 \\u7f8e\\u56fd\\u65F6\\u95F4\\uFF08\\u6d1b\\u6749\\u77f6\\uff09\\u20132007\\u5e7411\\u670810\\u65e5 \\u4e0a\\u534810:10 \\u7f8e\\u56fd\\u65F6\\u95F4\\uFF08\\u6d1b\\u6749\\u77f6\\uff09", + "zh", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "hmv", "2007\\u5e7410\\u670810\\u65e5 \\u4e0a\\u534810:10 PT\\u20132007\\u5e7411\\u670810\\u65e5 \\u4e0a\\u534810:10 PT", "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EEEEdMMMMy", "2007\\u5e7411\\u670810\\u65e5\\u661f\\u671f\\u516d\\u81f320\\u65e5\\u661f\\u671f\\u4e8c", @@ -449,7 +449,7 @@ public class DateIntervalFormatTest extends com.ibm.icu.dev.test.TestFmwk { "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "MMMM", "\\u5341\\u4E00\\u6708", // (fixed expected result per ticket 6872<-6626 and others) - "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hmz", "2007\\u5e7411\\u670810\\u65e5 \\u4e0a\\u534810:10 \\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4-0800\\u20132007\\u5e7411\\u670820\\u65e5 \\u4e0a\\u534810:10 \\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4-0800", + "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hmz", "2007\\u5e7411\\u670810\\u65e5 \\u4e0a\\u534810:10 PST\\u20132007\\u5e7411\\u670820\\u65e5 \\u4e0a\\u534810:10 PST", "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "h", "2007\\u5e7411\\u670810\\u65e5 \\u4e0a\\u534810\\u65f6\\u20132007\\u5e7411\\u670820\\u65e5 \\u4e0a\\u534810\\u65f6", @@ -457,25 +457,25 @@ public class DateIntervalFormatTest extends com.ibm.icu.dev.test.TestFmwk { "zh", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hm", "\\u4e0a\\u534810:00\\u81f3\\u4e0b\\u53482:10", - "zh", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hmv", "\\u7f8e\\u56fd\\u65F6\\u95F4\\uFF08\\u6d1b\\u6749\\u77f6\\uff09\\u4e0a\\u534810:00\\u81f3\\u4e0b\\u53482:10", + "zh", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hmv", "PT\\u4e0a\\u534810:00\\u81f3\\u4e0b\\u53482:10", - "zh", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hmz", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4-0800\\u4e0a\\u534810:00\\u81f3\\u4e0b\\u53482:10", + "zh", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hmz", "PST\\u4e0a\\u534810:00\\u81f3\\u4e0b\\u53482:10", "zh", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "h", "\\u4e0a\\u534810\\u81f3\\u4e0b\\u53482\\u65f6", - "zh", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hv", "\\u7f8e\\u56fd\\u65F6\\u95F4\\uFF08\\u6d1b\\u6749\\u77f6\\uff09\\u4e0a\\u534810\\u81f3\\u4e0b\\u53482\\u65f6", + "zh", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hv", "PT\\u4e0a\\u534810\\u81f3\\u4e0b\\u53482\\u65f6", - "zh", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hz", "\\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4-0800\\u4e0a\\u534810\\u81f3\\u4e0b\\u53482\\u65f6", + "zh", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hz", "PST\\u4e0a\\u534810\\u81f3\\u4e0b\\u53482\\u65f6", "zh", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "dMMMM", "1\\u670810\\u65e5", // (fixed expected result per ticket 6872<-6626) "zh", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hm", "\\u4e0a\\u534810:00\\u81f310:20", - "zh", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hmv", "\\u7f8e\\u56fd\\u65F6\\u95F4\\uFF08\\u6d1b\\u6749\\u77f6\\uff09\\u4e0a\\u534810:00\\u81f310:20", + "zh", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hmv", "PT\\u4e0a\\u534810:00\\u81f310:20", "zh", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "h", "\\u4e0a\\u534810\\u65f6", - "zh", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hz", "\\u4e0a\\u534810\\u65f6 \\u683c\\u6797\\u5c3c\\u6cbb\\u6807\\u51c6\\u65f6\\u95f4-0800", + "zh", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hz", "\\u4e0a\\u534810\\u65f6 PST", "zh", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "EEEEdMMMMy", "2007\\u5e741\\u670810\\u65e5\\u661f\\u671f\\u4e09", // (fixed expected result per ticket 6872<-6626) @@ -540,9 +540,9 @@ public class DateIntervalFormatTest extends com.ibm.icu.dev.test.TestFmwk { "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "MMM", "Okt-Nov", - "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "hmv", "10.10.2007 10:10 vorm. Vereinigte Staaten Zeit (Los Angeles) - 10.11.2007 10:10 vorm. Vereinigte Staaten Zeit (Los Angeles)", + "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "hmv", "10.10.2007 10:10 vorm. PT - 10.11.2007 10:10 vorm. PT", - "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "jmv", "10.10.2007 10:10 Vereinigte Staaten Zeit (Los Angeles) - 10.11.2007 10:10 Vereinigte Staaten Zeit (Los Angeles)", + "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "jmv", "10.10.2007 10:10 PT - 10.11.2007 10:10 PT", "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "hms", "10.10.2007 10:10:10 vorm. - 10.11.2007 10:10:10 vorm.", @@ -572,9 +572,9 @@ public class DateIntervalFormatTest extends com.ibm.icu.dev.test.TestFmwk { "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "M", "11", - "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hmv", "10.11.2007 10:10 vorm. Vereinigte Staaten Zeit (Los Angeles) - 20.11.2007 10:10 vorm. Vereinigte Staaten Zeit (Los Angeles)", + "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hmv", "10.11.2007 10:10 vorm. PT - 20.11.2007 10:10 vorm. PT", - "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "jmv", "10.11.2007 10:10 Vereinigte Staaten Zeit (Los Angeles) - 20.11.2007 10:10 Vereinigte Staaten Zeit (Los Angeles)", + "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "jmv", "10.11.2007 10:10 PT - 20.11.2007 10:10 PT", "de", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EEEEdMMMy", "Mittwoch, 10. Jan 2007", @@ -586,7 +586,7 @@ public class DateIntervalFormatTest extends com.ibm.icu.dev.test.TestFmwk { "de", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EEEEdMMM", "Mittwoch, 10. Jan", - "de", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hmz", "10:00 vorm. - 2:10 nachm. GMT-08:00", + "de", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hmz", "10:00 vorm. - 2:10 nachm. PST", "de", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "h", "10 vorm. - 2 nachm.", @@ -594,15 +594,15 @@ public class DateIntervalFormatTest extends com.ibm.icu.dev.test.TestFmwk { "de", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hm", "10:00-10:20 vorm.", - "de", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hmv", "10:00-10:20 vorm. Vereinigte Staaten Zeit (Los Angeles)", + "de", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hmv", "10:00-10:20 vorm. PT", - "de", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hmz", "10:00-10:20 vorm. GMT-08:00", + "de", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hmz", "10:00-10:20 vorm. PST", "de", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "h", "10 vorm.", - "de", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hv", "10 vorm. Vereinigte Staaten Zeit (Los Angeles)", + "de", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hv", "10 vorm. PT", - "de", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hz", "10 vorm. GMT-08:00", + "de", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hz", "10 vorm. PST", "de", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "EEEEdMMMy", "Mittwoch, 10. Jan 2007", @@ -610,19 +610,19 @@ public class DateIntervalFormatTest extends com.ibm.icu.dev.test.TestFmwk { "de", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "jm", "10:10", - "de", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hmv", "10:10 vorm. Vereinigte Staaten Zeit (Los Angeles)", + "de", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hmv", "10:10 vorm. PT", - "de", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "jmv", "10:10 Vereinigte Staaten Zeit (Los Angeles)", + "de", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "jmv", "10:10 PT", - "de", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hmz", "10:10 vorm. GMT-08:00", + "de", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hmz", "10:10 vorm. PST", - "de", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "jmz", "10:10 GMT-08:00", + "de", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "jmz", "10:10 PST", "de", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "h", "10 vorm.", - "de", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hv", "10 vorm. Vereinigte Staaten Zeit (Los Angeles)", + "de", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hv", "10 vorm. PT", - "de", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hz", "10 vorm. GMT-08:00", + "de", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hz", "10 vorm. PST", // Thai (default calendar buddhist) -- 2.40.0